What is wrong with this Python code?
This is the code.
salary = int(input("Enter salaryn"))
nam=0
tax=[0.0,0.1,0.2,0.3,0.4,0.5]
Auxiliary_tax=[100,200,300,400,500,600]
Auxiliary_salary=[000,23000,23000,74000,100000,100000000]
Index_tax=tax[nam]
Index_Auxiliary_tax=Auxiliary_tax[nam]
Index_Auxiliary_salary=Auxiliary_salary[nam]
while salary>0:
nam+=1
if salary<=Index_Auxiliary_salary:
Index_Auxiliary_tax = salary *Index_tax
break
else:
Index_Auxiliary_tax = Index_Auxiliary_salary*Index_tax
salary -= Index_Auxiliary_salary
print(Auxiliary_tax[1]+Auxiliary_tax[2]+Auxiliary_tax[3]+Auxiliary_tax[4]+Auxiliary_tax[5])
This code should receive a salary and spend the amount of tax in the graduated method
And this is the result.
enter image description hereThe code doesn’t end, just press enter and it goes down a line endlessly
New contributor
ישראל יעקב שווייצר is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
1