vendredi 21 mai 2021

Why does using 'if' in python give me syntax error results when all of my syntaxes are right?

I write a code with if and else in python .... everything is OK but give me syntax error I don't know why! my code:

if codepersoneli==123:
    username=input('please enter your username: ')
    password=int(input('please enter your password: ')
    if (username == 'mkj') and (password==251):
        print('welcome Mr.john')
    else:
        print('wrong username or password')
elif (codepersoneli==456):
    username=input('please enter your username: ')
    password=int(input('please enter your password: '))
    if(username=='msy') and (password==456):
        print('welcome Jain')
    else:
        print('wrong username or password')
elif (codepersoneli==789):
    username=input('please enter your username: ')
    password=int(input('please enter your password'))
    if(username=='mry') and (password==987):
        print('welcome David')
    else:
        print('wrong username or password')
else:
    print('wrong personal code')

when I run this code in VScode give me : line 5 if (username == 'mkj') and (password==251): ^ SyntaxError: invalid syntax

Aucun commentaire:

Enregistrer un commentaire