Dec-22-2018, 01:27 AM
hi friends! I am new here, I am new at programming also. I know a little bit excell vba but I just started learning python. this is my first attempt to write code on python. I watched some videos on youtube. Somebody wrote the same code in python 3.5.1 but I wrote in 3.7.1 . And it gives this error
it works when I delete the anterior identation before 'elif' but this time 'elif' is not working. Can somebody say to me whats the wrong thing ?
Error:line 9
elif ( user != defuser) and (password == defpassword):
^
SyntaxError: invalid syntax
it works when I delete the anterior identation before 'elif' but this time 'elif' is not working. Can somebody say to me whats the wrong thing ?
defuser="userkid" defpassword="1234" while ( "true" ): user = input("type your user name:") password = input("type your password: ") if (user == defuser) and (password == defpassword): print ("welcome",user) break elif ( user != defuser) and (password == defpassword): print("your user name is invalid") elif ( user == defuser) and (password != defpassword): print("password invalid") print ("change password? (y/n) ") answer = input() if ( answer == "y" ): print("newpassword?") newpassword = input("newpassword?") print("please wait") defpassword = neewpassword print("new password has been created ") else : print("try again")