is this perhaps what you are trying to do?:
if monthly_salary < 4000:
deductions = 0.12 + 0.04 + 0.01 + 0.06
elif monthly_salary >= 4000 and monthly_salary < 8000:
deductions = = 0.20 + 0.07 + 0.03 + 0.06
elif monthly_salary >= 8000 and monthly_salary < 16000:
deductions = 0.30 + 0.09 + 0.05 + 0.06
else:
deductions = 0.38 + 0.11 + 0.07 + 0.06
net_salary = monthly_salary - (deductions * monthly_salary)
3
solved How to use multiple values for one variable depending on the result of an if-else statement? [closed]