Hi everyone, I'm attempting Problem Set 0 on the 2011 course... can someone please give me some help with Problem 1? Thank you!
The way I did it was using raw input and storing each input into a variable. Name and date as two variables and then stored each on another variables, x and y as raw_input. Then printed x + y. Please let me know if you understand or need clarification.
what language?
Thank you @irvang ! You really helped me out :) Python 2.5.4 @magepker728
hmm java only sorry
Anytime. Glad I could help :)
It's all good! I'm just starting to learn; hopefully I can get some Java under my belt soon @magepker728
good luck and i wish you all the best :D
I am probably way too late on answering this one, but I struggled through this first problem set as well. The Python books I had on-hand didn't do a great job explaining the basic loop info and a lot of the stuff that seemed like it should have worked, errored out. I have very little programming experience so this could be wrong. However, both produced what appears to be a correct final output. Here is what I came up with: The first solution I created was a basic straight line program that didn't loop back in the event of an incorrect dob entry: y = int (raw_input('Please enter your date of birth (mmddyyyy): ')) x = raw_input('Please enter your last name: ') print x, y The second solution I came up with codes a loop into the program which accounts for users entering less than the requested 10 digit dob. y = raw_input('Please enter your date of birth (mm/dd/yyyy): ') if len(y) != 10: y = raw_input('Please enter your date of birth (mm/dd/yyyy): ') if len(y) == 10: x = raw_input('Please enter your last name: ') print x, y Happy coding :)
Join our real-time social learning platform and learn together with your friends!