Ask your own question, for FREE!
MIT 6.00 Intro Computer Science (OCW) 17 Online
OpenStudy (wizardbill):

1 x = ("What is your last name?") 2 y = ("What is your first name?") 3 print x+" "+y f5 Why does this not run?

OpenStudy (anonymous):

is that python code? what happens if you run that without the parenthesis

OpenStudy (wizardbill):

Yes, it is Python Code. If I run without Parenthesis, it says invalid code.

OpenStudy (anonymous):

x="hey there!!" y="whats up?!" print x+" "+y well this runs perfectly

OpenStudy (wizardbill):

Does that mean it is the spaces causing the problem? Let me try it without spaces

OpenStudy (wizardbill):

spaces are irrelevant. Line numbers it does not like. How can I make the program wait for the answer to the first question before submitting the 2nd question?

OpenStudy (anonymous):

you mean you want to print the answer to that question? Like print out your first and last name?

OpenStudy (wizardbill):

Exactly. I want it to allow me to enter the last name, then enter the first name, then print them out

OpenStudy (anonymous):

Aah! okay use raw_input .Its a built in function in python. It takes input from the user . x=raw_input("What's your first name?!!\n") y=raw_input("What's your last name?!\n") print x+" "+y

OpenStudy (wizardbill):

OK. I was putting them in the wrong order. I had raw_input=x("...

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!