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
'PYTHON' 카테고리의 다른 글
Answer (5-01) for Python for Everybody by Charles R Severance (0) | 2019.09.23 |
---|---|
Answer (4-07) for Python for Everybody by Charles R Severance (0) | 2019.09.23 |
Answer (4-06) for Python for Everybody by Charles R Severance (0) | 2019.09.23 |
Answer (3-03) for Python for Everybody by Charles R Severance (0) | 2019.09.23 |
Answer (3-02) for Python for Everybody by Charles R Severance (0) | 2019.09.23 |