Sunday 15 September 2013

python - Attempting to assign a variable to an value causes "Cannot assign to operator" error -



python - Attempting to assign a variable to an value causes "Cannot assign to operator" error -

def main(): bonus() def bonus(): #dollars sales input, time worked, #then salary , possible bonus added #to calculated commission based on earned commission rate monthlysales=int(input('how much money did employee create in sales?',)) if monthlysales<10000: commrate=0 elif monthlysales>=10000 , monthlysales<100000: commrate=0.02 elif monthlysales>=100001 , monthlysales<500000: commrate=0.15 , monthlybonus=1000 elif monthlysales>=500001 , monthlysales<1000000: commrate=0.28 , monthlybonus=5000 elif monthlysales>1000000: commrate=0.35 , monthlybonus=100000 yearsworked=int(input('how many years has employee worked here? round downwards nearest year.',)) if yearsworked>=5 , monthlysales>=100000: extrabonus+1000 elif yearsworked<1: monthsworked=int(input('how many total months has employee worked here?',)) if monthsworked<3: print('your employee has not worked here long plenty qualify bonus.') main()

what i'm trying create programme on predetermined commission rates based on how much in sales employee made input program.

i'm getting "cannot assign operator" error on

commrate=0.35 , monthlybonus=100000

, tells me i'll same error on rest of variables have been straight assigned numerical values amongst if nesting.

what doing wrong, here?

elif monthlysales>=100001 , monthlysales<500000: commrate=0.35 ; monthlybonus=100000

or

elif monthlysales>=100001 , monthlysales<500000: commrate=0.35 monthlybonus=100000

python operator-keyword

No comments:

Post a Comment