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

I am starting Pset 0. How do I write a program in IDLE. As in, I want to be able to write more than one line of code before IDLE runs my code. Thanks!

OpenStudy (espex):

You can either use an editor to write your code and IDLE to run it, or grab a program called PyScripter, http://code.google.com/p/pyscripter/, lovely little ide for python that is free.

OpenStudy (anonymous):

from the IDLE shell window you can open an editor window with menu item File | New Window after you have written code in the editor, F5 will run it with the results displayed in the shell window. be sure to save files with a .py extension to preserve the syntax highlighting.

OpenStudy (anonymous):

thanks guys! so it's a blank page. Do I need to add anything before getting started?

OpenStudy (espex):

Just the comments for the assignment are the only thing I can think of until you start importing things.

OpenStudy (anonymous):

i tried running this: x = raw_input('Please enter your birthdate (mm/dd/yyyy): ') y = raw_input('Please enter your last name: ') print x + y but it doesn't work.. am i missing something?

OpenStudy (anonymous):

also are we encouraged to asked questions, or look up previous questions? if the latter, how do i do so?

OpenStudy (espex):

For looking up questions you can use the codeacademy forum or google.

OpenStudy (espex):

When you say that your code didn't work, what "did" it do?

OpenStudy (anonymous):

it didn't prompt me for anything, and it gives back whatever i type

OpenStudy (espex):

You are typing in the editor and using F5 to run it?

OpenStudy (anonymous):

ah... that's why

OpenStudy (anonymous):

nice it works!

OpenStudy (anonymous):

Thank you so much. I'll keep working on it.

OpenStudy (espex):

You're welcome. Check out PyScripter if you have some free time. I personally prefer that over the IDLE editor.

OpenStudy (anonymous):

could you explain that to me a bit? like the difference between terminal and editor etc?

OpenStudy (anonymous):

so i downloaded python, and then idle. did i need idle?

OpenStudy (espex):

IDLE comes with Python, once you download and install the package you will have all you need to write in Python.

OpenStudy (espex):

The PyScripter is an IDE for Python, basically the same as the IDLE editor, just with a better user interface.

OpenStudy (espex):

The difference between an editor and terminal, is that in the terminal your commands are processed as soon as you hit the enter key.

OpenStudy (anonymous):

so what's the difference between command line and GUI?

OpenStudy (anonymous):

i just noticed that one is black and one is white

OpenStudy (espex):

Command line typically refers to a terminal, like if you were to open the "command prompt" in windows. GUI stands for Graphical User Interface, and typically refers to a "windowed" environment.

OpenStudy (anonymous):

but idle is terminal, right? and it's GUI?

OpenStudy (espex):

Technically IDLE is a GUI for the terminal.

OpenStudy (anonymous):

so GUI is basically just a better looking terminal, and the editor is where we actually write a program

OpenStudy (anonymous):

and then what's IDE?

OpenStudy (espex):

Well a GUI is a graphical representation for many interfaces, most likely you are using a GUI web browser to view this page. :)

OpenStudy (espex):

An IDE is and Integrated Development Environment. It brings together many of the tasks associated with programming into a nice user interface. You are presented with buttons to build your program, vs having to run a command on the command line.

OpenStudy (anonymous):

got it! thnx!

OpenStudy (espex):

You're welcome.

OpenStudy (anonymous):

hey when does print need parenthesis after it? i saw an example where if the variable is called x, no parentheses are used, and another where the variable is "changing," and parenthese were used...?

OpenStudy (espex):

The parenthesis aren't necessary. They most likely give away that the person writing the program was a 'C' programmer.

OpenStudy (anonymous):

i see..

OpenStudy (anonymous):

so for pset 0 that was it right? three lines? no loops?

OpenStudy (anonymous):

version 3+ of Python requires parens for the print function

OpenStudy (espex):

@bwCA beat me to it, I started playing with 3.x last night and discovered that the parenthesis were in fact required. There are some other changes as well that can create a learning speed-bump, so I'd suggest you stick with 2.7.x until you are more familiar with the language.

OpenStudy (espex):

And yes, that was it for your ps0, the bulk of the assignment was getting Python installed and familiarizing you with entering code.

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!