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

Just finished problem set #0. Not sure how to check for errors. I'd appreciate if someone would review and provide feedback. Below is the code. Thanks >>> print raw_input('What is your last name?') What is your last name? Smith Smith >>> print raw_input('What is your date of birth?') What is your date of birth? January 1, 2001 January 1, 2001 >>> a = raw_input ('What is your last name?') What is your last name? >>> b = raw_input ('What is your date of birth?') What is your date of birth? >>> print a,b

OpenStudy (anonymous):

you need to create a python file that can be saved. It makes everything easier. The code at the end will work.

OpenStudy (anonymous):

Can't this file be saved? Also, should it be saved in the shell or the text editor?

OpenStudy (anonymous):

o yeah sorry it can but do it in text editor

OpenStudy (anonymous):

Can I debug in the text editor?

OpenStudy (anonymous):

This is what I am attempting to debug in the editor. I'm getting the 'error in syntax..' error message: >>> print raw_input('What is your last name?') What is your last name? >>> print raw_input('What is your date of birth?') What is your date of birth? >>> a = raw_input ('What is your last name?') What is your last name? >>> b = raw_input ('What is your date of birth?') What is your date of birth? >>> print a,b

OpenStudy (anonymous):

If you do it in the text editor, you will finish off by hitting F5 to run the code all at once, and it will tell you if your code is syntactically correct or not. The interpreter (which is what you're running) is wonderful to try out single lines of code or whip something up on the fly, but you're going to want to get used to writing everything in the text editor if you want to create anything substantial OR save your code to run again.

OpenStudy (anonymous):

Thank you much! Just to rewind a little, here's what happened: After writing the code in the editor I hit F5. It prompted me to save the file. I complied by saving the file in a folder in 'My Documents'. Then the questions from the code appeared in the Python Shell. I answered the questions and everything seemed to work as entered. Does this sound correct? Thanks again

OpenStudy (anonymous):

Yup!

OpenStudy (anonymous):

Thank 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!