I'm making a program that calculates weekly pay and adds in overtime if a person exceeds 40 hours. The variable shows the correct value but I'm having an issue pushing it back to main to display, and I keep getting a None value when printing
hours = 45
rate = 10
overtime = 12
totalPay = 0
def basePay(hours, rate, totalPay):
if (hours <= 40):
totalPay = (totalPay + (hours * overtime))
print(totalPay)
return totalPay
else:
totalPay = (40 * rate)
hours = (hours - 40)
basePay(hours, rate, totalPay)
def main():
print(basePay(hours, rate, totalPay))
print(hours)
main()
I thought the variable was only available in the function block so I tried making it a global. value.