Last active
May 24, 2020 09:09
-
-
Save nnguyen168/b490b2520bf1da93b7d1c1b7f885d359 to your computer and use it in GitHub Desktop.
Code with redundant comments
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def calculate_pay(r, h, ovt, ovh, e): | |
""" | |
Function to calculate pay of a specific employee | |
Parameters: | |
r: the hourly pay rate | |
h: the work hours | |
ovt: the overtime pay rate | |
ovh: the overtime work hours | |
e: indicate if employee is eligible for overtime pay | |
Return: | |
the total amount of pay | |
""" | |
# calculate pay for normal working hours | |
t = r*h | |
# check if employee is eligible for overtime pay | |
if e: | |
# if yes, apply overtime rate | |
t = t + ovt*ovh | |
else: | |
# if no, apply normal rate | |
t = t + r*ovh | |
# return total pay | |
return t |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment