mercredi 2 septembre 2015

python, please tell me whats wrong

python,please help. I want this code to ask someone if they are ok with the grade. if they say yes, it prints good! if they say no, it says oh well! if they dont say yes or no, i want it to print " please enter yes or no" and keep asking them that until they finally say yes or no. This is what i have so far and when i run it and DONT type yes or no, it spams "please enter yes or no" millions of time

theanswer= raw_input("Are you ok with that grade?")
while theanswer:
    if theanswer == ("yes"):
        print ("good!")
        break
    elif theanswer == ("no"):
        print ("oh well")
        break
    else: 
        print "enter yes or no"

what do i need to do so that it works, ive been trying a lot

Aucun commentaire:

Enregistrer un commentaire