mirror of
https://github.com/coding-horror/basic-computer-games.git
synced 2025-12-23 07:29:02 -08:00
Avoid global variables
This commit is contained in:
@@ -55,7 +55,7 @@ def pick_number():
|
||||
return num
|
||||
|
||||
|
||||
def get_valid_guess():
|
||||
def get_valid_guess(guesses):
|
||||
valid = False
|
||||
while not valid:
|
||||
guess = input(f"Guess # {guesses} ? ")
|
||||
@@ -135,7 +135,7 @@ def main():
|
||||
guessing = True
|
||||
while guessing:
|
||||
|
||||
guess = get_valid_guess()
|
||||
guess = get_valid_guess(guesses)
|
||||
|
||||
if guess == num_str:
|
||||
print("You got it!!!\n")
|
||||
|
||||
Reference in New Issue
Block a user