Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #16651 > unrolled thread

Re: class print method...

Started byChris Angelico <rosuav@gmail.com>
First post2011-12-05 22:35 +1100
Last post2011-12-05 22:35 +1100
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: class print method... Chris Angelico <rosuav@gmail.com> - 2011-12-05 22:35 +1100

#16651 — Re: class print method...

FromChris Angelico <rosuav@gmail.com>
Date2011-12-05 22:35 +1100
SubjectRe: class print method...
Message-ID<mailman.3296.1323084954.27778.python-list@python.org>
On Mon, Dec 5, 2011 at 10:18 PM, Suresh Sharma <ss27051980@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

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web