Skip to content Skip to sidebar Skip to footer

Make Python Repeat A String Until Yes Or Yes Is Inputted

Yes I know that there is already a post covering this, but when I read it, it didn't help so please don't mark this as a duplicate. I want to write a program that asks the user if

Solution 1:

The following will keep on checking up on the user to see whether or not they need advice regarding a question:

def doTheyNeedAdvice(advice):
    while raw_input("Do you need advice? ").lower() == "no":
        pass
    print (advice)

print "How old am I?"

doTheyNeedAdvice("I am old enough")

Post a Comment for "Make Python Repeat A String Until Yes Or Yes Is Inputted"