File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22Calculate time and a half pay
33
44"""
5- def pay (hours_worked , pay_rate , hours = 40 ):
5+ def pay (hours_worked : float , pay_rate : float , hours : float = 40 ) -> float :
66 """
77 hours_worked = The total hours worked
88 pay_rate = Ammount of money per hour
99 hours = Number of hours that must be worked before you recieve time and a half
1010 """
11+
12+ # Check that all input parameters are float or integer
13+ assert (type (hours_worked ) == float or type (hours_worked ) == int ), "Parameter 'hours_worked' must be of type 'int' or 'float'"
14+ assert (type (pay_rate ) == float or type (pay_rate ) == int ), "Parameter 'hours_worked' must be of type 'int' or 'float'"
15+ assert (type (hours ) == float or type (hours ) == int ), "Parameter 'hours_worked' must be of type 'int' or 'float'"
16+
1117 normal_pay = hours_worked * pay_rate
1218 over_time = hours_worked - hours
1319 # Another way
You can’t perform that action at this time.
0 commit comments