Path: csiph.com!usenet.pasdenom.info!dedibox.gegeweb.org!gegeweb.eu!nntpfeed.proxad.net!proxad.net!feeder1-1.proxad.net!hq-usenetpeers.eweka.nl!hq-usenetpeers.eweka.nl!bcyclone03.am1.xlned.com!bcyclone03.am1.xlned.com!newsfeed.xs4all.nl!newsfeed4a.news.xs4all.nl!xs4all!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.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'else:': 0.03; 'elif': 0.05; '---------': 0.07; 'attribute': 0.07; 'class,': 0.07; '22,': 0.09; 'received:internal': 0.09; 'def': 0.12; 'random': 0.14; 'message-id:@webmail.messagingengine.com': 0.16; 'received:10.202': 0.16; 'received:10.202.2': 0.16; 'received:66.111': 0.16; 'received:66.111.4': 0.16; 'received:messagingengine.com': 0.16; 'subject:class': 0.16; 'tried:': 0.16; 'values?': 0.16; 'sat,': 0.16; 'wrote:': 0.18; 'import': 0.22; 'print': 0.22; 'header:In-Reply-To:1': 0.27; 'class': 0.32; 'skip:_ 10': 0.34; 'received:66': 0.35; 'skip:s 30': 0.35; 'received:10': 0.37; 'nov': 0.38; 'to:addr:python- list': 0.38; 'to:addr:python.org': 0.39; 'from:no real name:2**0': 0.61; 'header:Message-Id:1': 0.63; 'different': 0.65; 'subject:have': 0.80; '2014,': 0.84 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=fastmail.us; h= message-id:x-sasl-enc:from:to:mime-version :content-transfer-encoding:content-type:in-reply-to:references :subject:date; s=mesmtp; bh=PEzTdI8iIZDnN3OlK0P2Mrm+4Vw=; b=p9mh 8qGre8bABhihtn/NUreT+WuVbdR78BudzFEI6A3EU0GtK4qoJ6QeTsL+uT+RTMCQ a7m8u6b4gdey4D4ZiMswxauaEL4svcVp5CU9poSLwM+E50NYT7a2RIcHbavXOAaX aup+eZ7lFha/L+hQrm3NALJ6Hrtv8CdxfNs9/i8= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=message-id:x-sasl-enc:from:to :mime-version:content-transfer-encoding:content-type:in-reply-to :references:subject:date; s=smtpout; bh=PEzTdI8iIZDnN3OlK0P2Mrm+ 4Vw=; b=dUy/trUBV/xkWcGJhGQGfTnkyTrOKSlUEOQ/cgHl1yjwhpMRJrgRsURH vmAQykDge11ue8uYavs3ZxoRU5o4OEV/BgNmv+nK+etH7p6nXYHSEmpkzu+A34RI nCNoo3lyad8xYZTD3wQUmLI3OhN4EXUVfw1MQpz/70t7E7+sg6Q= X-Sasl-Enc: 1fvuuAdNJoxL/aPz1wXbBMootLvlGfQngrkmgZ+aVfKv 1416712111 From: random832@fastmail.us To: python-list@python.org MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain X-Mailer: MessagingEngine.com Webmail Interface - ajax-a419c8a0 In-Reply-To: References: Subject: Re: I have no class Date: Sat, 22 Nov 2014 22:08:31 -0500 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 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: 29 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1416712114 news.xs4all.nl 2894 [2001:888:2000:d::a6]:60283 X-Complaints-To: abuse@xs4all.nl X-Received-Body-CRC: 742816976 X-Received-Bytes: 4055 Xref: csiph.com comp.lang.python:81316 On Sat, Nov 22, 2014, at 21:47, Seymore4Head wrote: > What do I need to do to make a and b have different values? > import random > class RPS: > throw=random.randrange(3) > a=RPS > b=RPS > > print ("a ",a.throw) > print ("b ",b.throw) > if a.throw == b.throw: > print("Tie") > elif (a.throw - b.throw)%3==1: > print("a Wins") > else: > print("b Wins") > > --------- > I tried: > > class RPS: > def __init__(self): > self.throw=random.randrange(3) > > AttributeError: type object 'RPS' has no attribute 'throw' You need that class, and also a=RPS(); b=RPS().