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: Compute the pay rate

Post questions here.
REMOVED's my attempt:
def pay (hours, rate):
  g= hours*rate
  if g<100:
    t=.25
  if g>=100 and g <200:
    t=.3
  if g>=200 and g<300:
    t=.35
  if g>=300 and g<400:
    t=.45
  if g>=400:
    t=.5
  total= g-(g*t)
  print g
  print total

first why would you not do def pay (hoursrate)? second can u make 3 functions?
but it still accomplishes the same thing
PlREMOVED you're putting both values in right? At least that's that I got out of the question
REMOVED's my take. Student5295
def pay(hours,rate):
  grossPay=hours*rate
  if(grossPay<100):
    tax=grossPay*.25
    netPay=grossPay-tax
    print grossPay
    print netPay
  if(100<=grossPay<200):
    tax=grossPay*.30
    netPay=grossPay-tax
    print grossPay
    print netPay
  if(200<=grossPay<300):
    tax=grossPay*.35
    netPay=grossPay-tax
    print grossPay
    print netPay
  if(300<=grossPay<400):
    tax=grossPay*.45
    netPay=grossPay-tax
    print grossPay
    print netPay
  if(400<=grossPay):
    tax=grossPay*.5
    netPay=grossPay-tax
    print grossPay
    print netPay





Link to this Page