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 Page (locked)Uploads to this PageHistory of this PageHomeRecent ChangesSearchHelp Guide

Spring 2006 Midterm 1 Review: What gets printed

Spring 2006 Midterm 1 Review: What gets printed here.

REMOVEDmestar Rocks!
Everybody
Everybody
Everybody
Everybody
???
REMOVEDmestar Rocks!

When it says print value, what will be the result? There is value = 10 and inside the for loop there is value = value - 1. The answer I thought was 9 but i tried it in Jes (only to see if i got it right) and it keeps returning 6. REMOVEDw do you get the 6?

'value' keeps getting one subtracted from its value, which starts out at 10, every time the loop is executed. If it is executed REMOVED than once, its value, when printed after the loop will be less than 9. REMOVEDw much less depends on how many times the loop is executed – which you can work out from the code itself, of course, but which you also know directly from the program's output (how?). Colin Potts



Link to this Page