0
I'm not sure how to fix this in my code.
guess = int(input("Please enter your 3 digit # guess")) num_guesses = 1 while (guess != secret): if too high <--- (error here) else (too low) guess = int(input("Please enter another 3 digit # guess:)") num_guesses = num_guesses + 1 print("congratulations!") print("it took you , num_guesses, tries to get right")
1 Answer
+ 1
guess = int(input())
while (guess != secret):
if guess < high:
print("too low")
else:
print("too high")
guess = int(input())
print("guessed!")
# or shorter:
guess = int(input())
while (guess != secret):
print("too low" if guess < secret else "too high")
guess = int(input())
print("guessed!")