-1

I was just doing some practice in python I tried to print an input vairable but I get this error:

Traceback (most recent call last):
  File "mva1.py", line 1, in <module>
    name = input("what is your name?")
  File "<string>", line 1, in <module>
NameError: name 'Francis' is not defined

Here's my code:

name = input("what is your name?")
if name is "Francis":
    print "Welcome"

I also did this:

name = input("what is your name?")
print name

and on running it, I typed my name and got this error:

Traceback (most recent call last):
  File "C:/Users/DELL/Desktop/frankscute's/Practices/mva1.py", line 1, in <module>
    name = input("what is your name?")
  File "<string>", line 1, in <module>
NameError: name 'Francis' is not defined

I'm using Python 2.7 on PyCharm IDE

martineau
  • 119,623
  • 25
  • 170
  • 301
Francis Sunday
  • 77
  • 1
  • 11

1 Answers1

0

Python 2.7 uses raw_input not input. Use Python 3.2 for input for taking a user input. (in this case)

name = raw_input("what is your name?")
if name is "Francis":
    print "Welcome"# your code goes here
Maddy
  • 2,025
  • 5
  • 26
  • 59