jeudi 28 février 2019

My if statement line goes through even if it's True and should execute its return line

I'm running a while function. Inside this while func User input an int value that append to a list. I want to get the index of the last similar input from the list. But it keeps printing 'never entered' even the User input was already entered once on twice (see below)

list = [] #that list append from User in the while loop

def user(num):
    if num in list:
        return(drawlist.index(num))
    else:
        print(never entered)

Inside that while function :

...

print(user(num))

Aucun commentaire:

Enregistrer un commentaire