0

why am i getting an error in this progem ?

The program is: password=input("Enter your password:") print("your passowrd is"+password) if password != "hello123": print("wecome master") else: print("invalid password"+"try again") The output i got is: Enter your password:asegkh Traceback (most recent call last): File "pssword.py", line 1, in <module> password=input("Enter your password:") File "<string>", line 1, in <module> NameError: name 'asegkh' is not defined

16th Apr 2018, 3:53 PM
Christy Alex
Christy Alex - avatar
2 Antworten
+ 2
The code works fine for me, though at line 6 there is no need to concatenate the strings together. Additionally there might be a logic error when checking the password, if the password is hello123 then the if statement should say: if password == "hello123": instead of !=.
16th Apr 2018, 4:13 PM
TurtleShell
TurtleShell - avatar
+ 1
i got it i found the error,now its working Thanks for the help dude
17th Apr 2018, 6:16 AM
Christy Alex
Christy Alex - avatar