I need help with refactoring my program. I have a function that I am calling in two programs. In one program i just need the overtimeAmount, and in the other program I need all three variables returned. How can I refactor this two only return the variables i need for the program.
def OT2(hours, rate):
if hours > 160.0:
overtimeHours = hours - 160.0
overtimeRate = rate * 1.05
overtimeAmount = overtimeHours * overtimeRate
else:
overtimeAmount = 0.0
overtimeRate = 0.0
overtimeHours = 0.0
return overtimeHours, overtimeRate, overtimeAmount
namedtuplemodule could also give some improvements. PEP8 would also help,OT2looks like a constant, not a function.