My python program isnt running. Im sure im missing something but im pretty sure i just indented wrong. Can anyone lend me a hand? thank you!
def main():
sales = getSales()
advancedPay = getAdvancedPay()
commRate = DetermineCommRate(sales)
pay = (sales * commRate) - advancedPay
print("The pay is $". format(pay, ",.2f"), sep="")
if pay < 0:
print("The salesperson must reimburse")
print("the company")
def getSales():
monthlySales = float(input("Enter the monthly sales: "))
return monthlySales
def getAdvancedPay():
print("Enter the amount of advanced pay or ")
print("Enter 0 if no advanced pay was given. ")
advancedPay - float(input("Advanced pay: ")
return advancedPay
def DetermineCommRate
if sales < 10000:
rate = 0.10
elif sales >= 10000 and sales <= 14999.99:
rate = 0.12
elif sales >= 15000 and sales <= 17999.99:
rate = 0.14
elif sales >= 18000 and sales <= 21999.99:
rate = 0.16
else:
rate = 0.18
return rate
main()
My python program isnt running. Im sure im missing something but im pretty sure i just indented wrong. Can anyone lend me a hand? thank you!
From what I can see, sales
is a local variable in the main()
, and you are trying to access it in DetermineCommRate
, and you have syntax errors in the definition of that function
def DetermineCommRate(sales):
Currently, you are passing sales to it, but not accepting it.
Also, your following line should be indented to run in the main()
if pay < 0:
print("The salesperson must reimburse")
print("the company")
And a syntax error in this line too
advancedPay = float(input("Advanced pay: "))