jeudi 24 mars 2016

python- function isn't called in a while loop

noprob=["nothing","none","no damage"]

while True:
    q1=input("input your answer:")
    answer=q1.split(' ')`


    if any(a in answer for a in noprob):
        function()#wont call this
        break
    else:
        print("else statement")
        continue

def function():
    print("code now works")

my code won't call the function when it should. this code should recognize user input and output necessary actions.

Aucun commentaire:

Enregistrer un commentaire