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

I don't suppose anyone can help a noob crack problem set 0. I know I can get this stuff it just has to click with me. I can print things over and over again but I can't figure out how to get IDLE to do the sequencing thing...or how to get it to ask for a name and then ask for another name...etc...

OpenStudy (anonymous):

There is a way to open a new file (ctrl+N), write your code there and save it as pset0.py. Do ctrl+O (open) and open the saved file. It should work fine this way :-)

OpenStudy (anonymous):

So I should build it as a series of different files and save each step as a seperate file?

OpenStudy (anonymous):

No, not really. Say you want to print 5*4 and then ask for something from the user and print it back. You can write it in the file as: print 5*4 answer = raw_input('Enter anything!') print answer And the script will run everything. Conceptually, think as the IDLE just taking every line and running it sequentially, from top to bottom. Of course, this is not all the truth, but it will help you understand why this works.

OpenStudy (anonymous):

Ok so it's not a series of files because each file is given the same name...and I just save a piece of info on one file and then open another and perfom another step...I'll be able to call upon the info in the previous file when I need it...it'll be there for me as kind of a reference, for lack of a better term, so I can call upon it later...like a temporary stash for info...am I on the right track or way off?

OpenStudy (anonymous):

I am considering your problem is saving and running a file in IDLE. The fact that you can't enter more than a line of code in IDLE. If you need some way of saving the user input/data in a program, you should use variables, i.e. answer = raw_input('foo') If your problem is the former, then yes, it works more or less like that. Going a bit astray, I think you could think of it this way: The file has some sentences that makes syntactical(albeit not semantical) sense for the interpreter of Python (the Python interpreter in your computer). He goes and read that file line by line, saying what he is reading aloud (outputting it to the screen). The use of a saved text file allows for more than a line program be written and to check and modify your code if you catch any bugs/errors.

OpenStudy (anonymous):

So if I am understanding the problem that you are having, it seems that you are having trouble writing the code and saving it all in one file. bmp gave good info to solve this. In IDLE, you are going to open a new window using Ctrl+N, or select "File", "New Window." This will open a new window that just resemble a blank page. This will be your workspace. You are going to write all you code in this window, and then "Save as..." to save the file name as "pset0.py" I usually use F5 to Run the module which requires it to be saved before running. So, to clarify: open new window, write all the code in new window, F5 to save code and run in IDLE. IDLE will run through the module one line at a time, doing each step.

OpenStudy (anonymous):

It looks like you're confusion is just that you don't understand Idle which confuses you more about Python.... As mentioned above Ctrl+N will opens a new window, that is an Editor window. There you write out your code. Then you will save the code and call it from the Python Shell which is the original window. FYI, there is in option, Options -> Configure Idle ->General tab -> At Startup If you select Open Edit Window it should open the shell and editor (2 windows)

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!
Latest Questions
xXAikoXx: i have hip pain help.
1 hour ago 2 Replies 1 Medal
alphaXtiger: help .,.
2 hours ago 5 Replies 1 Medal
ihy: here's a song
4 hours ago 0 Replies 0 Medals
ihy: Here's a song I learned.
4 hours ago 0 Replies 0 Medals
abound: Im sad
4 hours ago 6 Replies 1 Medal
xXAikoXx: i got upper back pain help
5 hours ago 9 Replies 2 Medals
Gdub08: What's the best way to study for a test and quiz?
6 hours ago 9 Replies 1 Medal
dkffjlflsjkdfj: find the value of X
8 hours ago 2 Replies 0 Medals
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!