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 PageUploads to this PageHistory of this PageHomeRecent ChangesSearchHelp Guide

Midterm Exam 1 Review Fall 2005: What gets printed


what does "i" represent in the line: "for i in range(1, p):"?

What does "px" represent in "for px in getPixels(pic):"? How does that model translate to this? -Blake O'Hare
I fixed your post Blake. -poof #10

does it print 'Everybody, Everybody, Everybody, Everybody, 9, Homestar Rocks!'?

No. -Blake O'Hare

does it print 'Homestar Rocks!, everybody, everybody, everybody, everybody, 6, Homestar Rocks!'??

Yes. -Blake O'Hare

why 6? why not 9?

How many times does the value = value - 1 line execute? -Blake O'Hare

why does it print everybody 4 times?

does the value = value - 1 line execute 4 time: 10-1=9, 9-1=8, 8-1=7, 7-1=6. It executes 4 time because you are using range(1,5)?

Yes. -Blake O'Hare

I thought the function printed Everybody for values only 1-4 since the range is (1,5). But then that would mean the value at the end would be 1.

they tell you that the value = 10. so you take 10-1=9, then 9-1=8.... Just like above. You do this 4 times, and so your end value is 6.

So the range isn't what values you use it's how many times you do the loop?

def pay(hours, rate):
  gpay = (hours * rate)
  print(gpay)
  if gpay <100:
    print (gpay - (gpay*.25))
  if gpay >=100 and gpay <200:
    print (gpay - (gpay*.30))
  if gpay >=200 and gpay <300:
    print (gpay - (gpay*.35))
  if gpay >=300 and gpay <400:
    print (gpay - (gpay*.45))
  if gpay >=400:
    print (gpay - (gpay*.50))


is this okay for the gross pay question??


im retarded...ignore that comment above




Link to this Page