i enter this into print (raw_input('What is your name? ')) it says syntaxerror: invalid syntax.. what am o doing wrong
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
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.
give a variable name to your input so... a = (raw_input("what is your name: ")) print a // you are calling the variable to print
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
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 ?)
Join our real-time social learning platform and learn together with your friends!