class print method...

Chris Angelico rosuav at gmail.com
Mon Dec 5 06:35:51 EST 2011


On Mon, Dec 5, 2011 at 10:18 PM, Suresh Sharma <ss27051980 at gmail.com> wrote:
>
> Suit=[aces,clubs,diamonds,hearts]
> Rank=[2,3,4,5,6,7,8,9,j,Q,K,A]
> class Card:
> Def __init__(self,rannk,suiit):
> Self.suiit=suiit
> Self.rannk=rannk
>
> Def __str__(self):
> Return suit[suiit],rank[rannk]
>
> Class deck:
> Def __init__(cards):
> Self.cards=[ ]
> For suit in range(4):
> For rank in range(13):
> Self.cards.append(Card(suit,rank))
>
> Def __str__(self):
> s = ""
> For card in self.cards:
> S = str(self.cards)
> Return s.

Python is case sensitive, and indentation is significant. Paste your
code exactly as you're trying to run it, and we'll be better able to
help you.

Chris Angelico



More information about the Python-list mailing list