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.

0

1 Answer 1

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.