jeudi 4 juillet 2019

why is my if statement not returning the proper print?

I'm trying to learn python, when i use my if statement even when the correct number is input, the print is incorrect.

I've tried to change the number and make the number a sum but even when the code is accepted it doesn't seem to return the correct print.

def pin(n):
    if pin == 9999:
            print("Welcome to your account!")
    else:
            print("Intruder alert!")

I would expect when i type in pin(9999) to get the welcome to your account print but instead it always prints intruder alert! Please could someone enlighten me as to why this is.

Aucun commentaire:

Enregistrer un commentaire