Skip to main content
Code Review

Return to Answer

Commonmark migration
Source Link

#Organization

Organization

#Organization

Organization

deleted 2 characters in body
Source Link
Dair
  • 6.2k
  • 1
  • 21
  • 45
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.
added 15 characters in body
Source Link
Dair
  • 6.2k
  • 1
  • 21
  • 45
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.)

Source Link
Dair
  • 6.2k
  • 1
  • 21
  • 45
Loading
lang-py

AltStyle によって変換されたページ (->オリジナル) /