Problem Set 0 Hello, I believe my coding is correct for problem set 0, however Python will not execute the 2nd and 3rd lines of my code, and the program just terminates after the dob is entered. Any ideas on what is wrong? Thanks. Here is my code: dob = (raw_input("Please enter your date of birth in the form mm/dd/yy: ")) lname = (raw_input("Please enter your last name: ")) print lname, dob
If using a 3.x version, "raw_input()" no longer exists and simply "input()" will do as you wish. Also, the extra set of parentheses may be causing issues if you're in 2.x. You would only use those extra sets of parentheses if you were forcing a variable type such as: intVal = int(raw_input( "Please enter an integer: "))
(p.s. - I'm not in this class and it has been awhile since I've played with Python)
make a .py file and then run it.
I'm using Python 2.7.5, so raw_input should still be valid. I've removed the extra parentheses, as I wasn't clear on why they existed when looking at other code. I created the .py file with the code, however, I assumed incorrectly that copying and pasting the code into the Python Shell would run the program. My mistake, it seems to work now. Thanks Everyone.
Join our real-time social learning platform and learn together with your friends!