Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!nuzba.szn.dk!pnx.dk!amsnews11.chello.com!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.069 X-Spam-Evidence: '*H*': 0.87; '*S*': 0.00; 'python': 0.08; 'def': 0.13; 'received:209.85.210.174': 0.13; 'received:mail- iy0-f174.google.com': 0.13; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'subject:print': 0.16; 'mon,': 0.16; 'wrote:': 0.18; 'trying': 0.21; 'dec': 0.22; 'header:In- Reply-To:1': 0.22; 'indentation': 0.23; 'code': 0.25; 'skip:_ 20': 0.26; 'message-id:@mail.gmail.com': 0.28; 'pm,': 0.29; 'class': 0.29; 'chris': 0.30; 'to:addr:python-list': 0.34; 'run': 0.37; 'received:google.com': 0.37; 'skip:_ 10': 0.37; 'suit': 0.38; 'received:209.85': 0.38; 'help': 0.39; 'received:209': 0.40; 'to:addr:python.org': 0.40; '2011': 0.61; 'your': 0.61; 'you.': 0.63; 'card': 0.65; 'card:': 0.84; 'significant.': 0.84; 'suresh': 0.91; 'rank': 0.93 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=3lXotv5z1TUuUbFMBqzrD4HuqYX4RIosOEkQLzNsm1U=; b=JB9gAHikMyohJVD91gqCZYW5OUseurkDRUBjyjDlJUQbMVp/oBl7Juu6SOElpseFYb IwvJLbpsX9Qn3CdCaA/E8XpdRaVDDcyDTx8FnO34ISSDSEH0qUgbuv4eaS1bvwC+/s7r +I8zUiziV3wnwXzOBR7us3Rbz5dr2xhIC6ze0= MIME-Version: 1.0 In-Reply-To: References: <4EDC775D.4000906@davea.name> Date: Mon, 5 Dec 2011 22:35:51 +1100 Subject: Re: class print method... From: Chris Angelico To: python-list@python.org Content-Type: text/plain; charset=ISO-8859-1 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 30 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1323084954 news.xs4all.nl 6896 [2001:888:2000:d::a6]:43194 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:16651 On Mon, Dec 5, 2011 at 10:18 PM, Suresh Sharma 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