Skip to content

Commit 0e3d294

Browse files
authored
Update time&half-pay.py
1 parent f820218 commit 0e3d294

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

Diff for: financial/time&half-pay.py

+8-4
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,13 @@ def pay(hours_worked: float, pay_rate: float, hours: float = 40) -> float:
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
10+
>>> pay(41, 1)
11+
41.5
12+
>>> pay(65, 19)
13+
1472.5
14+
>>> pay(10, 1)
15+
10.0
1016
"""
11-
1217
# Check that all input parameters are float or integer
1318
assert (type(hours_worked) == float or type(hours_worked) == int), "Parameter 'hours_worked' must be of type 'int' or 'float'"
1419
assert (type(pay_rate) == float or type(pay_rate) == int), "Parameter 'hours_worked' must be of type 'int' or 'float'"
@@ -25,6 +30,5 @@ def pay(hours_worked: float, pay_rate: float, hours: float = 40) -> float:
2530

2631
if __name__ == "__main__":
2732
# Test
28-
print(pay(41, 1))
29-
print(pay(65, 19))
30-
print(pay(10, 1))
33+
import doctest
34+
doctest.testmod()

0 commit comments

Comments
 (0)