Ask your own question, for FREE!
MIT 6.00 Intro Computer Science (OCW) 8 Online
OpenStudy (anonymous):

This is a very dumb question but I am doing something wrong and I am not sure what it is. I am on the very first problem set and I am having a hard time with the "raw_imput()" code. Everytime I use this code it returns with: "Traceback (most recent call last): File "", line 1, in answer=raw_imput() NameError: name 'raw_imput' is not defined" I know this is something simple.

OpenStudy (anonymous):

I am using version 2.5.4 which is the suggested version for the class. Also, I have tried "imput()" and receive the same error.

OpenStudy (anonymous):

raw_iNput()

OpenStudy (anonymous):

Wow, thanks. I guess you need someone to slap you upside the head every once in awhile to let you know you are making a simple error. Thanks again.

OpenStudy (anonymous):

Hello, world! I am back. Hopefully, this question is not as dumb. So my understanding of creating a program is to create the file using a text editing program (text edit, text wrangler, etc), type in the code and save it as a ".py" file. My understanding of running the program is to change the directory to the folder where the ".py" file is located. Now, the problem I am running into is when I type in "cd pythonpractice" (pythonpractice is the name of the folder where my hello,py file is stored) is that it will return with a syntax error: >>> cd pythonpractice SyntaxError: invalid syntax I have saved the "python practice" folder in the home directory so I am not sure what I am doing wrong here…Please help!

OpenStudy (anonymous):

you need to go to the home directory first, type "dir" in the command line to show the current file/folders in the directory you are in

OpenStudy (anonymous):

>>> dir <built-in function dir> that is what I get. Just to correct what I said earlier, not the home directory but the home folder.

OpenStudy (anonymous):

so you are in the folder where the .py in?

OpenStudy (anonymous):

This is what I have been following: http://en.wikibooks.org/wiki/Python_Programming/Creating_Python_Programs

OpenStudy (anonymous):

I try to go to the folder where the file is in by typing: >>> cd pythonpractice

OpenStudy (anonymous):

ok, so you are in C:\ and your folder is there

OpenStudy (anonymous):

I try, but I get a syntax error. Also I am following the mac directions.

OpenStudy (anonymous):

what do you get if you type "pwd" ?

OpenStudy (anonymous):

Traceback (most recent call last): File "<pyshell#3>", line 1, in <module> pwd NameError: name 'pwd' is not defined

OpenStudy (anonymous):

In terminal or IDLE?

OpenStudy (anonymous):

terminal

OpenStudy (anonymous):

/Users/Anthony

OpenStudy (anonymous):

for terminal

OpenStudy (anonymous):

and do you know where is your pythonpractice folder located?

OpenStudy (anonymous):

same as above

OpenStudy (anonymous):

type "ls" and see if your folder is there

OpenStudy (anonymous):

OpenStudy (anonymous):

when i type that it shows in terminal

OpenStudy (anonymous):

ok try to cd to it again make sure you dont have a spelling mistake

OpenStudy (anonymous):

haha yes I have a track record of poor spelling. However, that is not the case. folder name from terminal when typing "ls" - pythonpractice (this is copied and pasted) response when typing it into IDLE - >>> cd pythonpractice SyntaxError: invalid syntax

OpenStudy (anonymous):

type cd pythonpractice in the terminal

OpenStudy (anonymous):

I dont know if this would make a difference but I am using version 2.5.4 which is the version used in the open courseware class from MIT

OpenStudy (anonymous):

when typed into the terminal it says "Anthonys-MacBook-Pro-2078:pythonpractice Anthony$"

OpenStudy (anonymous):

i don think the version is the issue, been while since i used idle and i dont know much about it, but you should type cd pythonpractice in terminal instead

OpenStudy (anonymous):

great now type ls what do you get ?

OpenStudy (anonymous):

it shows the file labeled "hello.py"

OpenStudy (anonymous):

now type "python hello.py"

OpenStudy (anonymous):

It printed "Hello, world!" Fantastic! So is IDLE used more for testing the strings?

OpenStudy (anonymous):

idle used to write the code, and you run it in the terminal, i think your mistake was that you trying ti cd in idle instead of the terminal, there are other application that let you code and run the application with just one click, i dont know what your course using other than idle but in mac i recommend using pycharm

OpenStudy (anonymous):

Great! Thanks! Are you taking this course as well?

OpenStudy (anonymous):

no i studied python in school in my first year

OpenStudy (anonymous):

That is great, a good thing to learn in school. Unfortunately for me I earned a degree that is not really helping me lol so I have to go back and learn this stuff. Thank you again for your help.

OpenStudy (anonymous):

no problem, python is really easy to learn and you dont really need school to learn everything, there are alot of good resources online, either courses like mit or videos on youtube. Good luck!

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!