I've finally decided to start learning python as my first language and so far i love it. I;m using python3 along with IDLE3. When writing a simple password prompt im running into a problem :/ script is as follows.
import sys password = input("Enter your password: ") if password != "pword" : sys.exit() print("Password correct") Now when i run the script and enter pass as the password i get the following error:
root@kali:~/Desktop# python password1.py Enter your password: pword Traceback (most recent call last): File "password1.py", line 2, in <module> password = input("Enter your password: ") File "<string>", line 1, in <module> NameError: name 'pword' is not defined Thanks in advance for your help guys, it's appreciated.
'pword'(notice the quotes, a string) but the error suggests you havepword(a bareword, undefined variable). If you really do have quotes around it try clearing out your__pycache__folder.raw_inputinstead ofinput