2 ms·
This blew my mind when I first came across it: deck = ['%s%s' % (n, s) for s in 'HDCS' for n in '23456789XJQKA'] It creates a deck of cards. Also, you ca
by RyanMcGreal 16y ago
This blew my mind when I first came across it:
deck = ['%s%s' % (n, s) for s in 'HDCS' for n in '23456789XJQKA']
It creates a deck of cards.
Also, you can easily shuffle the deck using the standard library.
import random
random.shuffle(deck)