• anonymous
Hi everyone. Im working on the first problem but whenever I input any program into the IDLE it will read and only follow the first line of code. Like Ill have x = raw_input('What is your date of birth? ') y = raw_input('What is your last name? ') print (y + x) It will ask the date of birth. I type it and press enter and it starts a new program as if the other lines of code weren't there. This seems to apply to all the prgms Im writing. Any help with this appreciated :)
MIT 6.00 Intro Computer Science (OCW)
  • Stacey Warren - Expert
Hey! We 've verified this expert answer for you, click below to unlock the details :)
At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.
  • katieb
I got my questions answered at in under 10 minutes. Go to now for free help!
  • TuringTest
You should not be typing your code directly into the IDLE. Open a new window with CTRL+N, type your code there, then press F5 to run it.
  • anonymous
ctrl+n to open a new window. save the new window with a py (.py at the end of the name of the file) extension. f5 and save to run and see the results in the idle window. you can have multiple windows open at the same time. it's neat.
  • anonymous
That's because the REPL process Reads the line when you hit enter, Evaluates it, and Prints. The next time around it doesn't print x because you did not tell it to. If you type x it will return what was entered into the prompt previously as you are in the same environment. But to answer your question, what you want (are trying) to do is pause Evaluate until you are done entering in your code, but when you hit enter, you are telling REPL to Evaluate. There is nothing in your code to tell REPL that there is a continuation, like, for example, if you were entering in a loop and the line ends in :

Looking for something else?

Not the answer you are looking for? Search for more explanations.