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 =/
MIT 6.00 Intro Computer Science (OCW)
Stacey Warren - Expert brainly.com
Hey! We 've verified this expert answer for you, click below to unlock the details :)
At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga.
Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus.
Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.
I got my questions answered at brainly.com in under 10 minutes. Go to brainly.com now for free help!
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
Not the answer you are looking for? Search for more explanations.
Im doing a similar problem. (Birthday and Last Name).
My code looks like this:
Last Name Doe
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:"
answer = raw_input()
question = "Enter your last name:"
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:
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.