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

PS0 - is this piece of code correct. It seems to work as it should, but I would like to be sure: "Enter your last name" x = raw_input ("Enter your last name") "Enter your first name" y = raw_input ("Enter your first name") print y print x When I execute it, I get the result as required. Anyone mind comment? Thanks

OpenStudy (anonymous):

Seems fine. Try using more descriptive variable names. firstName = raw_input("Enter your first name") vs y = raw_input("Enter your first name") It becomes much easier to tell later on which one is which. As an additional exercise, try getting the first and last name to print on the same line of output.

OpenStudy (anonymous):

Also, there's no need for the "enter your first name" and "enter your last name" lines. the raw_input function prints the prompt in the parentheses; the first and third lines aren't doing anything.

OpenStudy (anonymous):

Great. Thanks a lot.

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!