Here is my code for one of the functions I defined. I noticed that whether or not I use the while loop is not making a difference. I think that might be because in each of the else: , I make it jump back to the beginning of the function. How would I make the while loop actually come into play?
(I’ve currently put a # on each of the parts I didn’t use, which didn’t make a difference to when I run my code.
def san_diego():
print("Good choice! The weather is great here.")
print("Do you want to go to: Gaslamp or the beach?")
#want_to = False
#while True:
choice = input("Enter your choice: ")
if "Gaslamp" in choice:
print("Tough luck. You drink too much and pass out!")
exit(0)
elif "beach" in choice:
print("Great choice.You now have two more options.")
print("Do you want to build a bornfire or play in the water?")
#want_to = True
choose = input("Your choice >>> ")
if choose == "bornfire":
print("You enjoy hot cocoa!")
exit(0)
elif choose == "water":
water_play()
else:
print("I did not get that. Start over.")
san_diego()
else:
print("Error. Try again.")
san_diego()
Please give me some suggestions. Thank you!