 |  |

 |
 |  |  |
 | Welcome to CS1315. Click on the python to add comments.
|  |
 |  |  |
|
This page removed for FERPA compliance
|
        |
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):"? REMOVEDw does that model REMOVEDslate to this? -Student1680 |
I fixed your post REMOVED. -Student2042
does it print 'Everybody, Everybody, Everybody, Everybody, 9, REMOVEDmestar Rocks!'?
does it print 'REMOVEDmestar Rocks!, everybody, everybody, everybody, everybody, 6, REMOVEDmestar Rocks!'??
why 6? why not 9?
| REMOVEDw many times does the value = value - 1 line execute? -Student1680 |
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)?
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