I am working on the homework for the first week. I have a Mac with Python 2.6.6 in Terminal and IDLE available. How are we supposed to do these exercises? I have tried in IDLE and in Terminal. Nowhere does it have the option to "Run". It just runs on its own. I also have Text Wrangler installed as well as Python Launcher. I think I have too many options! Is there a link to instructions for doing these assignments on a Mac?
MIT 6.189 A Gentle Introduction to Programming Using Python (OCW)
At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga.
Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus.
Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.
When using the interpreter directly (i.e. IDLE), every line you enter will be ran dircetly.
It’s kinda like talking directly to the computer — you say a line, he confirms he understands (or says you wrote something he can’t understand), and if it’s something that he can give an answer to, he will as soon as you press
dircetly = drectly
(typo due to an issue with the colours in the textbox, sorry)
But what is the procedure we are supposed to use? Should we be typing the code into Terminal, IDLE, or something else like Text Wrangler? How do we get it from IDLE or Text Wrangler into Terminal? Where do we run it? I actually found difficulties in editing my code in Terminal. It wouldn't allow me to go back to the beginning to add another comment.
Not the answer you are looking for? Search for more explanations.
While Text Wrangler is just a text editor (like e.g. Vim or Emacs) and you use it to write programs in it, store it as a file (e.g. `my_proggie.py`)and then run it with the Python interpreter by either clicking on the file or running `python my_proggie.py` in the Terminal.
IDLE is an Integrated DeveLopment Environment for Python (other languages just call these IDE). Which is kinda like a bundle of tools needed to write, test and debug programs.
A quick intro into using IDLE can be found on: http://www.ai.uga.edu/mc/idle/index.html
That page is written with Windows in mind, but I imagine IDLE is pretty much the same for MacOS X.
Disclaimer: I’m on GNU/Linux and don’t use IDLE …never needed to. I just run Python from the terminal or write programs in Vim .
I haven’t gotten to the homework yet, but I think it’s just as fine if you stick to the tools you like and understand the most.
For me this is running Python(’s interactile shell) from the terminal directly for testing ideas and writing longer things in a text editor (Vim in my case). For my brother it’s IDLE for testing and Vim for writing longer code. He doesn’t bother with the
There are also other IDE that support Python as a language — KDevelop and PyDev for Eclipse come to mind. So, there is no One True Way™, try a few and see what feels good to you. In coding it’s equaly important as elsewhere that you’re comfortable with your working tools and environment ☺
When you are "developing" you want to be able to quickly switch back and forth between an editor (from which u can save your current state) and execution.
Try this video: http://www.youtube.com/watch?v=lBkcDFRA958
@SweetXOGrannie go back to http://mechanicalmooc.wordpress.com/2012/10/08/a-week-to-go-mmooc/ and look at the Berkeley document near the bottom. Should help.
If you're just starting out, I wouldn't recommend any of the editors that run in Terminal. TextWrangler would probably be the easiest for you to work with. I'm not a fan of IDLE. After you write/edit what you want in TW, save it to say, your Desktop. Then when you launch Terminal, immediately do:
and press enter. Now Terminal is in the same directory as your file. You can then execute your file with:
You can also open many Terminal windows. I frequently use 6 windows while I'm writing stuff. One of my windows will be the Python interpreter. Just type:
and hit enter. You can use this to test a couple/few lines of your program to make sure that they do what you want/expect them to do. The interpreter won't save any of this, but if it works, you can highlight it and copy it and then paste it into your editor window.
From IDLE (the window named Python Shell) click file and then 'open new window'.
That opens a window you can write your code in. When you want to run that code, first save your work as .py then click the "run" menu and select Python shell. Your code will then be executed by IDLE.