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

Am doing Problem Set 0. How do you revise code if mistakes are made?

OpenStudy (anonymous):

Well, presumably you're not writing code in a text editor. If you're just in the shell, like I think, what you want to do is restart the shell. You can do this by pressing ctrl+f6

OpenStudy (anonymous):

I write the code for the problem sets in the python text editor. It makes it easier to save the file, revise it and look at for future reference. When you download python you get the IDLE shell and the text editor.

OpenStudy (anonymous):

...and to open the text editor, go to IDLE and go to File -> New Window. Lots of new people miss this.

OpenStudy (anonymous):

This is great information. Thanks!

OpenStudy (anonymous):

Actually, the text editor does not appear to give any feedback. There is no way, that I can see, to tell if the code is correct/incorrect.

OpenStudy (anonymous):

When I select run from the menu, if there are any errors, messages will appear. If I forget a colon, the cursor will highlight the location in the code.

OpenStudy (anonymous):

What do you mean by "there is no way [...] to tell if the code is correct/incorrect?" There are three kinds of errors: syntax, static semantic, and semantic. IDLE will tell you have syntax errors when you hit F5 and try running the code. It won't tell you as you're writing it (in most cases...if you don't match parentheses, you actually will hear a *ding*), but once you try and run it, it'll tell you what went wrong and where to fix it. Static semantic error messages will usually appear during the running of the code. "Hey, you tried to divide by zero!" for example. But the only one ultimately who can know if your program is doing what you want it to be doing is you. The computer doesn't understand semantics, it only does what you tell it to do, and if your code, for example, returns a tuple when it should return a list, that's on you.

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!