python - __init__() missing 1 required positional argument: 'Value' -
i don't understand wrong. keep getting i'm missing required positional argument.
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 important in determining number of flips , simulating coin """ data = [] num_flip = int(input("how many times want flip coin? :")) print("the ball @ start: ball: d%, state: d% value: d% " %(self.id_num)) 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)
apparently, when use cointoss
, call 2 arguments, flip
, id_num
. cause error, because did not provide cointoss.__init__()
required value
argument.
Comments
Post a Comment