Quantcast

A community for students. Sign up today!

Here's the question you clicked on:

55 members online
  • 0 replying
  • 0 viewing

lviturei

  • 2 years ago

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 =/

  • This Question is Open
  1. thepenguin
    • 2 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    you need a comma in the last line after the apostrophe - it needs to be: print 'Your name is:', x+y

  2. wacsam
    • 2 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    Would this program print x before you input the last name?

  3. Gianko15
    • 2 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    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

  4. TheallMaster
    • 2 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    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.

  5. yak-coder
    • 2 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    ThealMaster, were the 2nd, 4th and 6th lines what u wrote or what the console replied?

  6. TheallMaster
    • 2 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    What the console replied.

  7. KobeAsdrubal
    • 2 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    //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)

  8. hootenanny
    • 2 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    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

  9. kb9agt
    • 2 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    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.

  10. KobeAsdrubal
    • 2 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    Thanks everyone... I did fix the problem!

  11. Not the answer you are looking for?
    Search for more explanations.

    • Attachments:

Ask your own question

Ask a Question
Find more explanations on OpenStudy

Your question is ready. Sign up for free to start getting answers.

spraguer (Moderator)
5 → View Detailed Profile

is replying to Can someone tell me what button the professor is hitting...

23

  • Teamwork 19 Teammate
  • Problem Solving 19 Hero
  • You have blocked this person.
  • ✔ You're a fan Checking fan status...

Thanks for being so helpful in mathematics. If you are getting quality help, make sure you spread the word about OpenStudy.

This is the testimonial you wrote.
You haven't written a testimonial for Owlfred.