input() error - NameError: name '…' is not defined

Python

I am getting an error when I try to run this simple python script:

input_variable = input ("Enter your name: ")

print ("your name is" + input_variable)

Lets say I type in "dude", the error I am getting is:

line 1, in <module>

input_variable = input ("Enter your name: ")

File "<string>", line 1, in <module>

NameError: name 'dude' is not defined

I am running Mac OS X 10.9.1 and I am using the Python Launcher app that came with the install of python 3.3 to run the script.

Edit: I realized I am somehow running these scripts with 2.7. I guess the real question is how do I run my scripts with version 3.3? I thought if I dragged and dropped my scripts on top of the Python Launcher app that is inside the Python 3.3 folder in my applications folder that it would launch my scripts using 3.3. I guess this method still launches scripts with 2.7. So How do I use 3.3?


If you want to unleash your potential in this competitive field, please visit the Python course page for more information, where you can find the Python tutorials and Python frequently asked interview questions and answers as well.

0
Answers

Replies

There are no replies to this topic.
 

This topic has been locked/unapproved. No replies allowed

Login to participate in this discussion.

Leave a reply

Before proceeding, please check your email for a verification link. If you did not receive the email, click here to request another.
WhatsApp
To Top