Ask your own question, for FREE!
Computer Science 16 Online
OpenStudy (javk):

Hey, can somebody help me with 'Problem Set 0: Introduction to Python and IDLE' http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-00sc-introduction-to-computer-science-and-programming-spring-2011/unit-1/lecture-2-core-elements-of-a-program/MIT6_00SCS11_ps0.pdf

OpenStudy (anonymous):

Sure, where did you get stuck? Have you installed Python and IDLE yet? What Operating System do you use? OSX, MS Windows or Linux?

OpenStudy (javk):

Ok umm...thankyou Well I have progressed a bit from yesterday... Yes I have successfully installed Python and IDLE OS: windows Now what? Yesterday I didn't know which one to open Python (Command line) or IDLE (Python GUI) Today I know that if I open IDLE (Python GUI) and then go to File and then New Window, that is where I am supposed to be working - but why? Then I attempted to do the programming based on what I read from the input and output section of the Python Wikibook, and I came up with this: print raw_input('Enter your date of birth: ') x = raw_input('Enter your date of birth: ') print raw_input('Enter your last name: ') y = raw_input('Enter your last name: ') print (y + x) The problem with this is that when I run it, it asks to ''Enter your date of birth' twice and to 'Enter your last name' twice, though I don't get why?

OpenStudy (anonymous):

Python is an interpreted language: the code is compiled on the fly. In the IDLE window you can enter statements which are interpred and output is given straight away. You can use it as a calculater, or check how statements work. In the New File window, you can write a program (also called a script). It is basically a text file. When saved the file gets a .py extention. When you run it straight away, the output is in the IDLE window again. One line after the other is interpreted, although when saved, it has been checked for proper python grammer. The advantage of the text editer window is that the python key words are highlighted. There are also languages where you have to write a seperate text file, which has to be compiled and where you The raw_input statement has the print part build in, and it also catches the value, but it has to be asigned to a variable, as in your second line. The input in your first line gets lost It is also possible to add a space or so between your y and x in your last statement print (y + ' ' + x) or you can use a comma, which also adds a space print y, x Have you watched the first lecture? Maybe it helps watching that first

OpenStudy (anonymous):

By the way, it is also possible to write a program in any other ASCII text editer, save it with a .py extention and open it with File -> Open... (or ctrl o) and choose that .py file

OpenStudy (anonymous):

I've downloaded all mp4 files in one go from http://ia600806.us.archive.org/25/items/MIT6.00SCS11/

OpenStudy (javk):

Yeah, I've watched the first couple of lectures, but when it comes to computers I've always had a little trouble with the implementation process... thankyou very much ... umm one more question, once I save it, is it possible to reopen it using the IDLE editor, uptill now I have been using notepad++ to go back, reopen and edit it

OpenStudy (anonymous):

yes, it is if you've saved your file When you've run it, it must have been You can find your previous work by File -> Recent Files and click on the one you want to open and the magic will be done

OpenStudy (javk):

k k thnx

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!