0

Why am I getting a NameError message here in pycharm, I have put this code into a different program and it works just fine.

profiles = {
'gabe': '12345',
'greg': '54321'
}

username = input('What is your username: ')

if username in profiles:
    password = profiles[username]
    if password == str(input('What is your password: ')):
        print('You logged in')
    else:
        print('Incorrect password')
else:
    print('Your username is incorrect')

console:

What is your username: gabe
Traceback (most recent call last):
  File "/Users/gaberbit/PycharmProjects/logon/login.py", line 6, in 
<module>
username = input('What is your username: ')
  File "<string>", line 1, in <module>
NameError: name 'gabe' is not defined

Process finished with exit code 1
DYZ
  • 55,249
  • 10
  • 64
  • 93

0 Answers0