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

Looking for the book? They have it at the Engineer's Bookstore at 748 Marietta St NW. Here is there website: http://www.engrbookstore.com/ - Monica

Hotspots: Slides and CodeTA CornerComments?AnnouncementsFAQStatic Webspace
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.

Homestar Rocks!
Everybody
Everybody
Everybody
Everybody
???
Homestar 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. How 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 more than once, its value, when printed after the loop will be less than 9. How 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