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

I am on lecture 2 (6.00) and using Python 3x. I am having problem with the following code. I type the same thing as the lecture but apparently i got the printout as y instead of 9. can anyone explain? y=0 x=3 itersLeft=x while (itersLeft>0): y=y+x itersLeft=itersLeft - 1 print ('y')

OpenStudy (anonymous):

The y in your call to print should not be in quotes unless you literally want to print the string 'y'.

OpenStudy (anonymous):

somewhere in the course instructions they said NOT to use Python 3.x because it is not backwards compatible and some of the example code won't work

OpenStudy (anonymous):

Yes, that's true, However, nearly everything will work except print, so if you're fine with making the necessary adjustments you can get away with using 3 if you really want to.

OpenStudy (anonymous):

I submit ... and your original answer solved the problem

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!