On Sat, 22 Nov 2014 22:08:31 -0500, random...@fastmail.us wrote:

>
>
>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().

That works.
Thanks
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to