I am trying to build a simple game and I would like Python to return a message when a player enters a negative number. My issue is that negative numbers are interpreted as strings when the player tries to enter them.
Here is my script:
while True:
user_guess = input("Guess a number: ")
if user_guess.isdigit():
user_guess = int(user_guess)
if user_guess < 0:
print("Too low, guess a number between 0 and 10.")
if user_guess > 10:
print("Too high, guess a number between 0 and 10.")
else:
print("It is not a number.")
break