我是python的新手,如果这非常简单,我很抱歉,但我有点卡住了,我已经查看了有关抛硬币的其他问题,但这比那些更简单:
简而言之,为什么我的编不工作?
class Coin:
showing_heads=True
value=1
def show(self):
if (self.showing_heads==True):
return "Heads"
else:
return "Tails"
def turn(self):
if (self.showing_heads==True):
self.showing_heads=False
else:
self.showing_heads=True
def run_cointoss(2):
coin1=Coin()
coin2=Coin()
print "This is coin1"
print coin1.show()
print "This is coin2"
print coin2.show()
print "Turn them over"
coin1.turn()
coin2.turn()
print "This is coin1"
print coin1.show()
print "This is coin2"
print coin2.show()