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

Hello guys. First of all, it is important i think to say that i am new to programming. I dont understand how Prof Guttag ran his script in the 22;22 mark of the lecture 2(core elements of a program). I downloaded the python software and I am using its IDLE because i did not understand the concept of an IDLE or if there are different kinds of IDLE. In short, what did John mean when he said"So the first thing to say is that things look a little bit different when they're executed from a script than when you execute them directly in the interpreter.

OpenStudy (rsmith6559):

IDLE is what's called an Integrated Development Environment, an IDE. IDE's allow you to edit, compile ( not needed in Python ), run and debug programs all from one environment. As programs get bigger, more complex and you're under deadline, an IDE may be very helpful. There are some usually minor differences between executing a statement from the Python interpreter and in a program file. One of the easiest demonstrations is: in the Python interpreter enter 2 + 2 and press enter. The interpreter responds 4. Now put 2 + 2 into a file and execute that. You don't get any output. 2 was added to 2, but that was all that the program said to do, it didn't say to output the result. You'd need to change the program to: print 2 + 2 which will output 4. In the interpreter, the print version will also output 4.

OpenStudy (anonymous):

Thank you. you said 'There are some usually minor differences between executing a statement from the Python interpreter and in a program file.'. which of them is the IDLE and which is the other one wherein code appears different. I understand so far the reasoning behind his work on the IDLE. I guess IDLE is the interpreter, right?. but how do you 'execute a statement directly via a script?.''. what program do you use or something. sorry if my questions seem foolish.

OpenStudy (anonymous):

As far as the class go, and I'm at lecture 4, what i understood from Prof. John Guttag is the interpreter is what translate code to computer command, and we can use IDLE to enter that code kind of in real time or create a script and write the code and run it. You can start a blank script file in IDLE by going to File > Open Window. Write the code and execute it by going to Run > Run Module from the top menu or pressing F5 and the statements in the script will be executed. You can also save the script file from here.

OpenStudy (rsmith6559):

IDLE is usually used with two windows. The blank window is for editing a program. The window with: Python 2.7.10 (default, Jul 14 2015, 19:46:27) [GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.39)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> or whatever, is the interpreter. The interpreter is also commonly referred to as the Python shell. IDLE includes the interpreter, and is actually a Python program.

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!