I'm trying to get this game to run ad infinitum until the user enters "q" or "quit". For some reason, this isn't quite working out with what I have. I initially tried to do this with two functions but failed miserably, so I consolidated for right now into one function to try to get it going. Still failing, but not as bad.
#Ex9: Guessing game. Generate a number between 1-9 and provide info whether its too high or low
import random
#print("Type q or quit to quit")
#guess = int(input("Please enter a number between 1 to 9: "))
def guessing_function():
while True:
quit1 = print("Type q or quit to quit")
guess = int(input("Please enter a number between 1 to 9: "))
value = random.randint(1,9)
if quit1 == "quit".lower() or "q".lower():
print("Ok we will stop")
break
elif guess > value:
print(f"The computer generated {value}")
print(f"You picked {guess}. That value is too high")
elif guess < value:
print(f"The computer generated {value}")
print(f"You picked {guess}. That value is too low")
elif guess == value:
print(f"The computer generated {value}")
print(f"You picked {guess}. That value is correct!")
guessing_function()
Basically the issue is that the script just stops after one loop, rather than continue on without the user's input.... Not sure what I'm doing wrong.