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

I have just finished problem set 0. I have it asking for first name, then last name. My question is... Is there a way to assign a variable to the users inputed data (i.e. the name they enter? )

OpenStudy (anonymous):

I'm not sure what you mean. You want to assign a variable to store the data? Did you try first_name = raw_input('Enter first name')

OpenStudy (anonymous):

no but after trying that it works thanks so much. sorry for the stupid question

OpenStudy (anonymous):

No worries at all. Just remember that the calling raw_input will give you a string just like typing one directly into the code does. It just takes the string from the user as the code is running rather than having to be set by hand. So it's like saying first_name = 'Bob' except that you don't have to know what the user will enter when you write the code.

OpenStudy (anonymous):

Cool, makes sense. You seem to really know what you're doing. I'm literally brand new with computer programing to the point that I had never even heard of Python until yesterday. I realized I have to learn alot of the terminology first before actually utilizing it but as I briefly glance at problem set 1 it seems overwhelming. Is this something to you eventually just get the hang of or am I a lost cause?

OpenStudy (anonymous):

Did you watch the first 2 videos? If not, be sure to do that, and do the readings before trying the assignments. Also, don't be afraid to play around with the code to make sure you understand what it's doing. Finally ask for help. No question is too silly and there are lots of people who are willing to lend a hand.

OpenStudy (anonymous):

Yeah, I need to look at the readings. Thanks for your help

OpenStudy (anonymous):

Polpak, Thank you, the above dialogue was quite helpful for me, I had only watched the first video/lecture and was trying to do assign. 0 and finding myself overwhelmed! I'll go back and watch the second and do the readings before attempting the assignment - even so- your explanation of the raw_input was helpful. -Romi

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!