Im having a problem with the enter your name problem, my code looks like this print x = raw_input('Enter your First name') y = raw_input('Enter your Last name' ) print 'Your name is: ' x+y its not working =/
you need a comma in the last line after the apostrophe - it needs to be: print 'Your name is:', x+y
Would this program print x before you input the last name?
you don't need to put, print x = raw_input('Enter your First name'), cuz is a input command, that line should give you a syntax error, and try to make it look better like: x = raw_input('Enter your First name: ') y = raw_input('Enter your Last name: ' ) And in the print you should have put the "," instead of "+" cuz it will joing name and lastname, the "," gives you a space. print 'Your name is:', x, y
Im doing a similar problem. (Birthday and Last Name). My code looks like this: >>>x=raw_input('Birthday') Birthday 01/01/2000 >>>y=raw_input('Last Name') Last Name Doe >>>print y,x Doe 01/01/2000 >>> When I try to run it I also get a syntax error.
ThealMaster, were the 2nd, 4th and 6th lines what u wrote or what the console replied?
What the console replied.
//This is my code, It looks kind of complicated. I didn't think about using "X and Y" // My answer looks like ('Doe', '3/14/85') // I want to know why it put parentheses and commas. I just want it to print out the last name and date of birth question = "Enter your date of birth:" print (question) answer = raw_input() question = "Enter your last name:" print (question) response = raw_input() print (response, answer)
It's because the code has print with parentheses. Try instead: print response, answer for your last line of code. I think this is a Python 2 vs. 3 thing. Here's a more thorough explanation that I found: http://docs.python.org/3.0/whatsnew/3.0.html#print-is-a-function
You don't need the first print statement. It could look like this user_birthday = raw_input('Enter your date of birth: ') It will prompt without the print command.
Thanks everyone... I did fix the problem!
Join our real-time social learning platform and learn together with your friends!