Today I learned that while loops are the same as for loops except they continuously run until a condition is met. So one must be extra careful to use break or other criteria for certain while loops otherwise they’ll continue to run forever!
This could be very useful for the choose your own adventure story. For instance if I want the player to continually guess an answer until they get it right I could write something similar to:
movement = [“left”, “back”]
chosen_movement = “”
while chosen_movement not in movement:
chosen_movement = input(“please choose a direction to run from the zombies”)
print(“You ran away! Well done”)
Also was reminded by the Udemy course the importance of putting .casefold() after a variable if I want to account for lower and uppercase answers!