Today in class, I made a number guessing game.

This is the code that determines whether the users guess was too high, too low, or correct. It also tells the user how many guesses it took.
if guess < lowest_num or guess > highest_num:
print("That number is out of range")
print(f"Select a number between {lowest_num} and {highest_num}")
elif guess < answer:
print("Too low! Try again")
elif guess > answer:
print("Too high! Try again")
else:
print(f"CORRECT! The answer was {answer}")
print(f"Number of guesses: {guesses}")
is_running = False
This is the code for when the user enters something invalid.
else:
print("Invalid guess")
print(f"Select a number between {lowest_num} and {highest_num}")

No Responses