I'm currently trying to create a pay function using python 3.50, which looks like this: the user enters the hourly payment as "x" and the hours as "y". I am trying to implement part of the overtime work, where if the hours worked exceed 40 people, 1.5 times more is paid during these extra hours. I enter the wage (10.45) and return 525, when I obviously should return 475, can someone help me choose my mistake? Help will be greatly appreciated, thanks for your time in advance.
def wage(x, y):
if y > 40:
ehours = y - 40
overtime = x * 1.5 * ehours
return x * y + overtime
else:
return x * y
source
share