Ask a Question
Ask Question Login
Corporate Training
  1. Community
  2. Data Science
  3. Question
Data Science

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

Asked by Fukuda Ashikaga Jul 12, 2021 2.8K views 1 answer
Share

About this question

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 
input_variable = input ("Enter your name: ")
File "", line 1, in
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?

Your answer

1 Answer

More Data Science discussions

Learn & Explore

Free tutorials and interview questions from industry experts — learn the skill, then get ready to prove it.

Latest Data Science Blogs

Guides, tips and career advice on Data Science from JanBask experts.