fork download
  1. def gross_pay(hours, rate_per_hour):
  2. if hours <= 40: # até 40 horas, rate normal
  3. return hours * rate_per_hour
  4. # acima de 40 horas, 1.5 * rate
  5. return 40 * rate_per_hour + (hours - 40) * (rate_per_hour * 1.5)
  6.  
  7.  
  8. hours = float(input('hours:'))
  9. rate_per_hour = float(input('rate per hour:'))
  10. print(gross_pay(hours, rate_per_hour))
Success #stdin #stdout 0.02s 9168KB
stdin
45
10.5
stdout
hours:rate per hour:498.75