Skip to content

Instantly share code, notes, and snippets.

@nnguyen168
Last active May 24, 2020 09:09
Show Gist options
  • Save nnguyen168/b490b2520bf1da93b7d1c1b7f885d359 to your computer and use it in GitHub Desktop.
Save nnguyen168/b490b2520bf1da93b7d1c1b7f885d359 to your computer and use it in GitHub Desktop.
Code with redundant comments
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