Hi there,
This is my first time posting so I am sorry if its not perfect
I am working on a FreeCell game right now where I need to deal a deck of cards into 7 separate piles. This is the code I have right now for dealing it into seven piles
import cards
deckDict = {}
mydeck = cards.Deck()
mydeck.shuffle()
x = 1
list_1 = []
list_2 = []
list_3 = []
list_4 = []
list_5 = []
list_6 = []
list_7 = []
while x <= 7:
card = mydeck.deal()
if card == None:
break
list_(int('%d' % (x))).append = card
if x == 7:
x = 1
x += 1
This is the problem line
list_(int('%d' % (x))).append = card
I know I can do this with 'if' statements, but I would like to keep my code as short as possible and I have a feeling that you should be able to change the list, but I cannot find it on the web or figure it out myself.
Any help would be great, even if it is to tell me that I will just have to man up and use if statements.
Thanks, Andrew