我的python程序沒有運行。林肯定我缺少的東西,但我很確定我只是縮進錯了。任何人都可以借我一隻手嗎?謝謝!python縮進
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()
我的Python程序運行未啓用。林肯定我缺少的東西,但我很確定我只是縮進錯了。任何人都可以借我一隻手嗎?謝謝!
'advancedPay語法錯誤運行 - 浮動(輸入(「高級薪酬:''''用'='替換'-'並添加一個關閉的零部件 –
你有的另外一個問題是'def DetermineCommRate'寫得不對,你忘記了左括號和冒號=>'def DetermineCommRate():' – idjaw
你的語法不對,請校對碼。 – TigerhawkT3