[Tutor] A row of cards, but they're all red
Andre Roberge
andre.roberge at gmail.com
Mon Jan 30 12:21:35 CET 2006
On 1/30/06, ->Terry<- <tvbare at socket.net> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
[snip]
Try reducing your code to only the following:
>
> Here's the code:
> - --------------------------
> #!/usr/bin/env python
> suits = ["red ", "blue", "green", "yellow"]
> ranks = ["ace", "two", "three", "four", "five", "six", "seven",
> "EIGHT", "nine", "ten", "jack", "queen", "king"]
> value = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]
>
> for suit in suits:
> for x, rank in enumerate(ranks):
> cards.append([suit, rank, value[x], images[x]])
>
And replace the last line by:
print [suit, rank, value[x], x]
You will see that "x" is not doing what you want it to inside images...
As a hint, I'd suggest looking at writing
for y, suit in enumerate(suits)
and changing the index of images[x].
Good luck!
André
More information about the Tutor
mailing list