[Tutor] Displaying elements of twoTuples
bob gailer
bgailer at gmail.com
Mon Sep 14 14:03:37 CEST 2009
**** Please read and follow all advice you receive. **** Otherwise
trying to help gets very frustrating.
**** Be sure copies of your replies go to the Tutor List. **** (Yes I
took the effort to find out which list you had written to). Best way is
to reply-all.
**** DO NOT USE the same name for the tuple of suits and an individual
suit. **** That is what is screwing up your results. Did you walk thru
the program step-by-step?
shellcom3 at juno.com wrote:
> This is my rewrite
>
> value = ("A","2","3","4","5","6","7","8","9","10","J","Q","K")
>
> suit = ("c","h","s","d")
>
>
>
>
> for card in value:
> for suit in suit:
> print card + suit
>
> This is the output only shows part of the possible deck of cards or suits.Ac
> Ah
> As
> Ad
> 2d
> 3d
> 4d
> 5d
> 6d
> 7d
> 8d
> 9d
> 10d
> Jd
> Qd
> Kd
>
>
also note that you can use strings instead of tuples: (using T instead
of 10)
values = "A23456789TJQK"
suits = "chsd"
OR
values = "A 2 3 4 5 6 7 8 9 10 J Q K".split()
--
Bob Gailer
Chapel Hill NC
919-636-4239
More information about the Tutor
mailing list