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')

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.

Get our expert's

answer on brainly

SEE EXPERT ANSWER

Get your free account and access expert answers to this and thousands of other questions.

A community for students.

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')

MIT 6.00 Intro Computer Science (OCW)
See more answers at brainly.com
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.

Get this expert

answer on brainly

SEE EXPERT ANSWER

Get your free account and access expert answers to this and thousands of other questions

The y in your call to print should not be in quotes unless you literally want to print the string 'y'.
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
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.

Not the answer you are looking for?

Search for more explanations.

Ask your own question

Other answers:

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

Not the answer you are looking for?

Search for more explanations.

Ask your own question