#Organization
Organization
#Organization
Organization
def __init__(self):
self.guesses = []
self.game_states = []
self.code = [random.randint(0,[] 9)# forAdd ithis inlater range(when you define length)].
def __init__(self):
self.guesses = []
self.game_states = []
self.code = [random.randint(0, 9) for i in range(length)]
def __init__(self):
self.guesses = []
self.game_states = []
self.code = [] # Add this later when you define length.
def __init__(self):
self.guesses = []
self.game_states = []
length = int(input("Choose length of code to break: ")) # This is fine, but replace `length` with `len(self.code)`
self.code = [random.randint(0, 9) for i in range(length)]
(Also, I would keep length
as a local variable defined in run
and then refer to len(self.code)
instead.)
self.guesses = []
self.game_states = []
length = int(input("Choose length of code to break: ")) # This is fine, but replace `length` with `len(self.code)`
self.code = [random.randint(0, 9) for i in range(length)]
def __init__(self):
self.guesses = []
self.game_states = []
self.code = [random.randint(0, 9) for i in range(length)]
(Also, I would keep length
as a local variable defined in run
and then refer to len(self.code)
instead.)
lang-py