A community for students.

Here's the question you clicked on:

55 members online
  • 0 replying
  • 0 viewing

anonymous

  • one year ago

i enter this into print (raw_input('What is your name? ')) it says syntaxerror: invalid syntax.. what am o doing wrong

  • This Question is Open
  1. mathmate
    • one year ago
    Best Response
    You've already chosen the best response.
    Medals 0

    You do not need to print it. rawinput automatically prints what you supplied. Read more examples here: https://docs.python.org/2/library/functions.html

  2. rsmith6559
    • one year ago
    Best Response
    You've already chosen the best response.
    Medals 0

    Which version of Python are you using? The way you wrote print() is Python v3 syntax. raw_input() is much different in Python v3, it's basically a Python v2 function.

  3. anonymous
    • one year ago
    Best Response
    You've already chosen the best response.
    Medals 0

    give a variable name to your input so... a = (raw_input("what is your name: ")) print a // you are calling the variable to print

  4. anonymous
    • one year ago
    Best Response
    You've already chosen the best response.
    Medals 0

    In this case it would be easy to do this using a variables. The code may look like something like this. question = "What is your name" print (question) answer = raw_input () also refer input and output section of the python wikibook

  5. anonymous
    • one year ago
    Best Response
    You've already chosen the best response.
    Medals 0

    Assuming you are using python 2.7 print (raw_input ('What is your name?')) is correct. However as is explained in the python wiki book input and out put section that "No inputted statements ca span more than one line" So if you run just the above line the programe should look something like What is your name <and the user can input data here>. however if you have another input statement, after print (raw_input ('What is your name')) the code will return an error message. Was there by any chance an input staement before print (raw_input ('What is your name?'))?. in this case you can use variables as was shown in my previous reply Or you can simply type raw_input (what is your name ?)

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

    • Attachments:

Ask your own question

Sign Up
Find more explanations on OpenStudy
Privacy Policy

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.