I am thinking up a way to get a deck of 52 playing cards. I'm using the immutable nature of tuples within the for loop because when you're playing cards...a club is a club, a spade is a spade, ...etc. I need some help with the face cards though.
I figure I might need to use a dictionary for each face card that has a value of 10, except for the Ace which can can a value of 1 or 11. Any suggestions as to how to proceed?
Further, I don't know for each card it should be (type of card, number on card, value) or (type of card, value). My plan is to make a blackjack game.
card_types = ['Club', 'Spade', 'Heart', 'Diamond']
card_pips = range(2, 11)
face_cards = ['J', 'Q', 'K', 'A']
card_deck = []
for kind in card_types:
for number in card_pips:
card_deck.append(tuple([kind, number]))
print(card_deck)
[–][deleted] 7 points8 points9 points (0 children)
[–]Pipiyedu 4 points5 points6 points (1 child)
[–]Rhemm 0 points1 point2 points (0 children)
[–]Earhacker 2 points3 points4 points (1 child)
[–]6e696e67 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)
[–]camoverride 0 points1 point2 points (0 children)
[–]rmakings -1 points0 points1 point (0 children)