Respuesta :
Answer:
def compute_pay(number_of_hours, rate_of_pay):
if number_of_hours > 40:
pay_for_week = (40*rate_of_pay)+((number_of_hours-40)*\
(rate_of_pay+rate_of_pay*0.5))
else:
pay_for_week = number_of_hours*rate_of_pay
if pay_for_week >= 375:
print("Paying %d by direct deposit" % pay_for_week)
else:
print("Paying %d by mailed check" % pay_for_week)
Explanation:
- We define the computer pay function that receives the number of hours worked in a week and the rate of pay
- From the test cases we deduce that if a worker works more than 40 hours a week an extra payment is given, you can calculated it as follow: (40 * rate_of_pay) + ((number_of_hours - 40) * (rate_of_pay + rate_of_pay * 0.5))
- If a worker works less than 40 hours the payment is calculated as follow: pay_for_week = number_of_hours * rate_of_pay
- If the pay for week is equal or greater than 375 we print a payment by direct deposit otherwise we print payment by mailed check
