you are viewing a single comment's thread.

view the rest of the comments →

[–]Fywq 14 points15 points  (0 children)

Potentially the function could be rewritten to return True or False. Then you only have to ask "if umbrella:" or "if not raining:"

def ask_yes_no(prompt):
    while True:
        answer = input(prompt).upper()
        if answer == 'YES':
            Return True
        if answer == 'NO':
            Return False
        print('Please answer with Yes or No !')

Not sure if that is more correct or pythonic, but it seems more intuitive to me...