Where do I find the answer to Problem Set 1,the very first programming problem that asked us to write a program to print our name and date of birth. I got the program to work, but want to make sure I did it the same. It said the answer was posted on Lecture 4 but I don't see it there.
I have found the organization to be somewhat confusing too. That problem is labeled problem set 0, and I don't think there is any answer posted. It is simply: x = raw_input('Enter your date of birth: ') y = raw_input('Enter your last name: ') print y,x For the later problem sets, you find the problem set and the answers in the future lecture when it is due. Problem set 1 is found in lecture 4, problem set 2, in lecture 6, etc. Hope that helps.
The program that has only one solution is a rarity. If the program runs properly, including handling weird data, it's probably good. If the program is written so that you can pick it up years in the future and quickly know what is going on in each section of code, then it's REALLY good. BTW, I've got code running that I wrote before the turn of the century. I do wish that I'd commented it and used better variable names.
Alene, I did mine a bit different than that: x=str(raw_input('enter your date of birth')) ans=x y=str(raw_input('enter your last name')) ans=y print y, x Worked fine.
TracyN, I like how putting the comma into the print command puts a space between the 2 variables. Was this in the lecture or did you find it somewhere else? I used the following, somewhat clunky, code: print x + " " + y Trying to get a space between the 2 was kind of driving me crazy! Thanks for sharing this!
Join our real-time social learning platform and learn together with your friends!