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 "
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.
raw_iNput()
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.
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!
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
>>> 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.
so you are in the folder where the .py in?
This is what I have been following: http://en.wikibooks.org/wiki/Python_Programming/Creating_Python_Programs
I try to go to the folder where the file is in by typing: >>> cd pythonpractice
ok, so you are in C:\ and your folder is there
I try, but I get a syntax error. Also I am following the mac directions.
what do you get if you type "pwd" ?
Traceback (most recent call last): File "<pyshell#3>", line 1, in <module> pwd NameError: name 'pwd' is not defined
In terminal or IDLE?
terminal
/Users/Anthony
for terminal
and do you know where is your pythonpractice folder located?
same as above
type "ls" and see if your folder is there
when i type that it shows in terminal
ok try to cd to it again make sure you dont have a spelling mistake
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
type cd pythonpractice in the terminal
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
when typed into the terminal it says "Anthonys-MacBook-Pro-2078:pythonpractice Anthony$"
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
great now type ls what do you get ?
it shows the file labeled "hello.py"
now type "python hello.py"
It printed "Hello, world!" Fantastic! So is IDLE used more for testing the strings?
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
Great! Thanks! Are you taking this course as well?
no i studied python in school in my first year
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.
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!
Join our real-time social learning platform and learn together with your friends!