Skip to content

Commit 1b600ba

Browse files
fix input exceeding guess range
1 parent a3ad71f commit 1b600ba

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

week7/guessing_game.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,10 @@ def play(max_value: int,
7474
save_result(file, tries, og_max, guess_function)
7575
break
7676
elif guess < secret:
77-
min_value = guess + 1
77+
min_value = guess + 1 if guess > min_value else min_value
7878
print("Guess higher")
7979
else:
80-
max_value = guess - 1
80+
max_value = guess - 1 if guess < max_value else max_value
8181
print("Guess lower")
8282

8383

0 commit comments

Comments
 (0)