def main():
bonus()
def bonus():
#Dollars from sales are input, then time worked,
#then the salary and possible bonus is added
#to the calculated commission based on the earned commission rate
monthlySales=int(input('How much money did your employee make in sales?',))
if monthlySales<10000:
commRate=0
elif monthlySales>=10000 and monthlySales<100000:
commRate=0.02
elif monthlySales>=100001 and monthlySales<500000:
commRate=0.15 and monthlyBonus=1000
elif monthlySales>=500001 and monthlySales<1000000:
commRate=0.28 and monthlyBonus=5000
elif monthlySales>1000000:
commRate=0.35 and monthlyBonus=100000
yearsWorked=int(input('How many years has your employee worked here? Round down to the nearest year.',))
if yearsWorked>=5 and monthlySales>=100000:
extraBonus+1000
elif yearsWorked<1:
monthsWorked=int(input('How many full months has your employee worked here?',))
if monthsWorked<3:
print('Your employee has not worked here long enough to qualify for a bonus.')
main()
我想要做的就是在其預定的佣金率是基於由員工多少銷售額是輸入程序進入程序。試圖將一個變量分配給一個值導致「不能分配給操作」錯誤
我越來越對
commRate=0.35 and monthlyBonus=100000
「無法分配給運營商」的錯誤,告訴我,我會得到對已直接指定數值之間的變量,其餘相同的錯誤嵌套0。
我在做什麼錯了,在這裏?
sepearate分成兩行drop&''或'或分號';' – nu11p01n73R 2014-10-27 04:22:42
使用元組賦值'a,b = 1,2'導致'a == 1'和'b == 2' – IanAuld 2014-10-27 04:23:58