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? )
MIT 6.00 Intro Computer Science (OCW)
Stacey Warren - Expert brainly.com
Hey! We 've verified this expert answer for you, click below to unlock the details :)
At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga.
Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus.
Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.
I got my questions answered at brainly.com in under 10 minutes. Go to brainly.com now for free help!
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')
no but after trying that it works thanks so much. sorry for the stupid question
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.
Not the answer you are looking for? Search for more explanations.
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?
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.
Yeah, I need to look at the readings. Thanks for your help
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.