New to python, trying to make multiple choices for users that'll do different things and it always loops through the first option... there should be several options but first trying to debug this and move from there. thanks in advance.
import webbrowser
options = ["Learn Python", "Go swimming", "Go to school", "play video games" ,"Study Java", "Play Magic", "quit"]
google_search = "https://www.google.com/search?q="
#basic quarry search for google
google_Maps = "https://www.google.com/maps/place/"
#basic quarry search for maps
for i, option in enumerate(options, 1):
print(i , ". " + option, sep='', end='' + "\n")
keyword = input("Choose an option to explore: ")
if keyword == "1" or "learn python".casefold():
webbrowser.open(google_search + "learn python", new=1)
elif keyword == "2" or "go swimming".casefold():
location = input("Please enter the city you want to go swimming at: ")
webbrowser.open(google_Maps + "swimming pools in " + location, new=1)
else:
print("Bye!")
Aucun commentaire:
Enregistrer un commentaire