Working on Problem set 0. Can print each instruction individually but stuck on how to "print out the user's last name and date of birth in order."
Some examples of what does and does not work with print that might help: ``` Python 2.7.2 (default, Jun 12 2011, 15:08:59) [MSC v.1500 32 bit (Intel)] on win32 Type "copyright", "credits" or "license()" for more information. >>> a = 1 >>> b = "one" >>> print a, b 1 one >>> print a + b Traceback (most recent call last): File "<pyshell#3>", line 1, in <module> print a + b TypeError: unsupported operand type(s) for +: 'int' and 'str' >>> print str(a) + b 1one >>> ```
Thanks! Working on it.
this is how i did it print ('Whats your date of birth:') DOB = raw_input('') print ('Enter your last name:') Last = raw_input ('') print (Last, DOB)
DOB=raw_input(")? and Last= raw_input(")? These give syntax errors. Please explain brb_96.
You are not supposed to put the question mark there.
try this name=input("what is ur name") dob=input("what is ur dob") print (name,"was born on,",dob)
u cld include the ? in the input string. works just fine
Valmangroup, be careful with skinnyrabbito's code. S/he is using a different version of Python that is much different than what you're using.
sorry i'm using 3.x but then yes the error message says it all. u cannot concatenate a string and an integer
i wrote this in notepad then saved it as (all files) .py s = (' ') x = raw_input('what is your name? ') d = raw_input('what day were your born? ') m = raw_input('what month were you born? ') y = raw_input('what year was that? ') print 'you are: ' + x print 'born: ' + m + s + d + s + y raw_input('press enter to exit')
Problem set 0 wants us to "print out the user's last name and date of birth in that order." I have gotten as far as printing out "What is your last name?" and "What is your date of birth?", but still can't understand how to actually "print out the users last name and date of birth in that order." Do I understand the assignment? If my name is John Doe and was born on Jan. 7 1965 then the final response should print: Doe, 1/7/65....right?
See how Cisekjoseph is adding things together in the print. Or how I did in my example? That is how you do printing. Here is a reference to alot of the basics: http://www.tutorialspoint.com/python/index.htm
Watch the first 10 videos here: http://thenewboston.org/list.php?cat=36 All are very short and have typed examples. Bucky does a good job of getting people started, but I don't like his stuff after the intro area.... but that is me.
Great references E.Mccormick! Those are the fundamentals I was looking for. Thanks!
Yah, once you have the basics, the MIT stuff makes more sense. They made the videos for people that already knew a little programming and had a different class for people that did not. But they don't have videos for the other class. So those fill the gap.
Join our real-time social learning platform and learn together with your friends!