0

I have written the following code:

name = input("What is your name: ")
print(name)

It is giving the below error when I input my name

/usr/bin/python2.7 /home/sreedhar/PycharmProjects/Sample1/sample.py What is your name: Sree Traceback (most recent call last): File "/home/sreedhar/PycharmProjects/Sample1/sample.py", line 1, in name = input("What is your name: ") File "", line 1, in NameError: name 'Sree' is not defined

Process finished with exit code 1

Can some body help me debug this code, I have started python today. And I'm using python community 17.2 on Linux mint for this.

Sreedhar Danturthi
  • 6,709
  • 19
  • 67
  • 107

1 Answers1

1

use raw_inputinstead:

name = raw_input("What is your name: ")
print(name)

see Python 2.7 getting user input and manipulating as string without quotations

input works on python 3.x, not in 2.x

jps
  • 15,760
  • 14
  • 59
  • 71