0
class name:
    def create(self):
        person=input("Enter your name")
        print('hello {}'.format(person))

During running the following error occurs!What is the mistake?

 o=name()
 o.create()
 Enter your nameshubham

Traceback (most recent call last):
File "<pyshell#53>", line 1, in <module>
o.create()
File "<pyshell#51>", line 3, in create
person=input("Enter your name")
File "<string>", line 1, in <module>
NameError: name 'shubham' is not defined
Tom Karzes
  • 22,815
  • 2
  • 22
  • 41
shubhamj
  • 778
  • 1
  • 7
  • 13
  • Are you using python 2? If you just started learning python I'd suggest you to move to python3. – Bakuriu Mar 16 '16 at 07:13

1 Answers1

0

I guess your are using a lower version than Python 3.x so you have to use raw_input() here since input() tries to interpret your feed.

You can find the explanation here.

Community
  • 1
  • 1