Ask your own question, for FREE!
MIT 6.189 A Gentle Introduction to Programming Using Python (OCW) 7 Online
OpenStudy (anonymous):

Inside the main method, variable x has already been declared as an int and has been assigned a value of 5. Which of the following statements would later give x a new value of 10? 10 = x; int x = 10; x + 5; x = 10;

OpenStudy (anonymous):

you assign values with '=' whatever is on the right gets copied to what's on the left. you use things like 'int' to create memory but you already created memory for x so you can't do it again

OpenStudy (anonymous):

So it would be int x = 10; ...? @iamheretohelp

OpenStudy (anonymous):

no because you already created an int. you're just reassigning a value.

OpenStudy (anonymous):

Oh I misread what you said above. x = 10?

OpenStudy (anonymous):

yeah thats right

OpenStudy (anonymous):

I see now. Thanks! :)

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!