File tree 1 file changed +7
-1
lines changed
1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change 2
2
Calculate time and a half pay
3
3
4
4
"""
5
- def pay (hours_worked , pay_rate , hours = 40 ):
5
+ def pay (hours_worked : float , pay_rate : float , hours : float = 40 ) -> float :
6
6
"""
7
7
hours_worked = The total hours worked
8
8
pay_rate = Ammount of money per hour
9
9
hours = Number of hours that must be worked before you recieve time and a half
10
10
"""
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
+
11
17
normal_pay = hours_worked * pay_rate
12
18
over_time = hours_worked - hours
13
19
# Another way
You can’t perform that action at this time.
0 commit comments