I'm trying to make a little guessing game in python by using the random import.
Problem is, I want the user to be able to enter "exit" to end, but I also need to compare their data to the random number. My thinking now is, how can I ask the user for an int, but also check if they entered a string called exit?
The code is supposed to let them keep playing if they guess it right.
so far i have this.
import random
num = random.randint(1, 100)
guess = input("Enter your guess: ")
while guess != "exit":
if guess.isdigit() == False:
guess = input("Please enter valid number: ")
elif guess > num:
print("Lower!")
elif guess < num:
print("Higher!")
elif guess == num:
print("YOU GOT IT!!!!!")
print("Setting new number.")
num = random.randint(1, 100)
guess = input("Enter number now: ")
print("Terminating game now.")