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
, который говорит мне, что я получаю ту же ошибку на остальных переменных, которые были непосредственно назначены числовые значения среди if
гнездование.
Что я делаю не так, здесь?
sepearate в две строки, отбрасывающие 'и'или использовать точку с запятой'; ' – nu11p01n73R
Использовать назначение tuple' a, b = 1, 2' приводит к 'a == 1' и' b == 2' – IanAuld