Book "Python for Everybody" by Charles R Severance

 

Exercise 3.1: Rewrite your pay computation to give the employee 1.5 times the rate for hours worked above 40 hours.
Enter Hours: 45
Enter Rate: 10
Pay: 475.0
Python for Everybody: Exploring Data Using Python 3

# start

hours = float(input("Enter Hours: "))
rate = input("Enter Rates: ")
if hours > 40 :
    rate = float(rate)
    pay = (40 * rate) + ((hours - 40) * rate * 1.5)
    print("Pay: ", pay)
else :
    pay = hours * float(rate)
    print("Pay: ", pay)

# end

+ Recent posts