-2

I am making some code that is based on a game. I have gotten a traceback which I haven't encountered before even though I have used these lines of code before. Here is the code:

print ("please enter your Forename")
fore = input()
print ("Please enter your Surname")
sur = input
if fore == ("Benjamin"):
    print("ATTENTION. System Breach Detected. Purging System.")

and this is the error:

line 26, in <module>
    fore = input()
  File "<string>", line 1, in <module>
NameError: name 'Benjamin' is not defined
jonrsharpe
  • 107,083
  • 22
  • 201
  • 376
Omen_
  • 3
  • 5

1 Answers1

0

In Python 2, input() evaluates the user input as if it were a Python command. Thus, if you type "Benjamin", Python will try to evaluate Benjamin as a command. Consider using raw_input() instead.

Amos Egel
  • 803
  • 8
  • 22