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

I am very new to this and have no programming background at all. I wrote this for assignment 0 . print "What is your first name?" raw_input() print "what is your last name?" raw_input() Is it correct?

OpenStudy (anonymous):

Correct yes, but on the topic of writing a "small program" wouldn't it seem to be more fitting to also use the inserted strings for a returning print (like Hello first_name last_name.)? If you need help on assigning a variable to the users input, take a look at this in IDLE's shell (pythons interpreter): help(raw_input) It will give you the info, how to correctly use the looked-up statement/command (in a bit abstract way... i had say). Also a tip: Take your time watching some more lectures and first few recitations, before attempting to write something on your own. Makes it much easier... and you can still go back to assignments and quizes, if those are important to you.

OpenStudy (anonymous):

I did watch 2 lectures and did some reading before writing that. I just wrote in easiest way I could think of. Thanks for your reply!

OpenStudy (anonymous):

Guttag has the right idea, but I feel it is best if you watch the lecture and then immediately try to write the program. They are geared towards one using the concepts that are taught in those lectures, not by using some method which, although may solve the problem that was asked, does not stress the point they were trying to make. That being said, I think you should look at this: http://en.wikibooks.org/wiki/Python_Programming/Variables_and_Strings. You're assigning the values to your variables, but you need to do something with them now in order for the user to see them. Otherwise the user will input the data and then the program will stop.

OpenStudy (anonymous):

What do you guys think of this ###First Name and Last Name print"Hello,I am going to ask your first and last name" print"Press Enter when ready" raw_input() first_question="what is your first name?" second_question= "what is your last name?" first_comment= "what a nice name" second_comment= 'That must be a famous last name' print first_question raw_input() print first_comment print second_question raw_input() print second_comment print"Thanks for info, Have a good day"

OpenStudy (anonymous):

Works perfectly, good work!

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!