Need to close a while loop with a user input
I'm trying to make a small game that asks trivia questions. I have it almost ready but I can't figure out how to close the while loop I have.
while True:
Choose = input("What topic would you like?")
if Choose == "History" or Choose == "history":
import History
break
elif Choose == "Geo" or Choose == "geo" or Choose == "geography" or Choose == "Geography":
import Geo
break
elif Choose == "I'm done!":
print("Thanks for playing!")
break
else:
print("Sorry, please enter a valid topic")
continue
while True:
Choose = input("What topic would you like?")
if Choose == "History" or Choose == "history":
import History
elif Choose == "Geo" or Choose == "geo" or Choose == "geography" or Choose == "Geography":
import Geo
elif Choose == 'quit':
print("Ok, bye bye!")
break
else:
print("Sorry, please enter a valid topic")
Some details that you might find interesting:
Choose.lower() == "history"
can be used instead of doing if X or x. This also applies to Geo/geo, etc.
Naming variables with lower cases is generally the standard. choose