I have several lists (deck, hand, playfield, discardpile) filled with Card objects. How can I move Cards from one list to the other in a clean pythonic way ?
This is what i have now: (and it doesn't work properly)
Can I do this in a smoother way ?
Since the previous code was not doing what I want, i use this now :
Is this the shortest way?
This is what i have now: (and it doesn't work properly)
Code:
for i in range( len(hand)-1,0,-1):
if hand[i].isRed():
playfield.append(hand.pop(i))
Since the previous code was not doing what I want, i use this now :
Code:
i = 0
while i<len(hand):
if hand[i].isRed() :
playfield.append(hand.pop(i))
else :
i+=1
Comment