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

I have downloaded .py 2.7 from python.org when I go to start --> python 2.7 --> IDLE (Pythong GUI) I type this in: x = 3 # Create variable x and assign value 3 to it x = x * x # Bind x to value 9 print x n = raw_input('Enter a number:') print n # print n/n How do I make this run (execute) like the professor is doing at the 27.00 minute mark in the following video: http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-00-introduction-to-computer-science-and-programming-fall-2008/video-lectures/lecture-2/

OpenStudy (anonymous):

Are you typing it into the interpreter or a separate file? If it's the interpreter, you'll see ">>>" in front of every line, and in that case, the interpreter evaluates every line separately. For example, as soon as you typed "print x", the number 9 would show up. If you want to type multiple lines and execute everything all at once, then go to File -> New Window and save that new file as blahblah.py (make sure you actually type the py to maintain the code coloring). Type in all the text into that new file, and then either go to Run -> Run Module, or just hit F5.

OpenStudy (anonymous):

In the Python Shell, click File --> New Window. In the new window, type in the code, and save it....like "example.py." Then run the module (click F5)

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!