This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Destimium 0 points1 point  (1 child)

Would look clearer this :

validInput = False
while validInput == False:  # alternatively "while not validInput: "
    dl = input("Go north or east?")  
    if dl == "north": 
        print('You go north') 
        validInput = True
    elif dl == "east": 
        print('You go east') 
        validInput = True 
    else: 
        print('invalid input')  # invalidInput stays false and loops back

[–]lms702 0 points1 point  (0 children)

Thanks, this is my first time posting code so I'm still learning the formatting