Change Contents of the Bubble
Welcome to CS1315. Click on the python to add comments.

This page removed for FERPA compliance
View this PageEdit this PageUploads to this PageHistory of this PageHomeRecent ChangesSearchHelp Guide

Fall 2007 Test 1 Review: What gets printed

Post questions here.
I tried to predict what the code did, but I was quite puzzled when it returned a 6 when the
print value
line was executed. If value is set to 10 (when q >50, which it is), and we redefine value as value = value - 1, shouldn't JES return a 9 instead of a 6?
Value is set to 10 regardless of q's value. We change value inside the for loop. That is where you will find your answer. Thanks! Brittany Duncan
What's "i"?
i is a value that changes every time through the loop. Don't be confREMOVEDed by the fact that i isn't REMOVEDed or printed out anywhere. We jREMOVEDt need it for the for loop to work. The number of times the loop will repeat is the number of items in the list that is returned by range(1,p). Colin Potts
We change value inside the for loop??????????????? i dont see how it can be 6 i dont see where it got changed.

hmm.. i get:
REMOVEDmestar Rocks!
Everybody
Everybody
Everybody
Everybody
6
REMOVEDmestar Rocks!

me either,,,,, how it got 6 instead of 9????????
REMOVEDw many times do the commands inside the loop - including the one that subtracts one from value - get repeated????????????? Colin Potts
OHHHHHHHHHHHHHHHHHHHHHHHHHH................................................. :D !




Link to this Page