我不明白怎么了。我一直觉得我缺少一个必要的位置论证。在
class CoinToss(object):
def __init__(self, flip, ID_Num, Value):
self.flip = flip
self.ID_Num = ID_Num
self.Value = Value
def Flip(self):
"""
Method is important in determining the number of flips and simulating the coin
"""
data = []
Num_flip = int(input("how many times do you want to flip the coin? :"))
print("the ball at the start: ball: d%, state: d% value: d% " %(self.ID_Num))
for i in range(Num_flip):
self.flip = self.flip = 1
if randint(0,1) == 0:
self.Value = self.Value + 1
data.append(self.value)
else:
self.Value = self.Value - 1
data.append(self.Value)
显然,当您使用}。这将导致错误,因为您没有为
CoinToss
时,您只使用两个参数来调用它,flip
和{CoinToss.__init__()
提供必需的Value
参数。在相关问题 更多 >
编程相关推荐