Member 12716803 Ответов: 1

Программирование на Python , расчет налога на зарплату


The code below is my python program for calculating the tax of yearly salaries, but the code is giving me error, "'int' object is not iterable". can anybody help me out?                                                                                               def calculate_tax(data):
	app = {}
	for name in data:
		if data[name] >=0 and data[name] <= 1000:
			value = data[name] - 0
			app[name] = value * 0 
		if data[name] >=1001 and data[name] <=10000:
			tax1 = 1000 * 0
			value2 = data[name] - 1000
			tax2 = value2 * 0.1
			app[name] =  tax1 + tax2
		if data[name] >=10001 and data[name] <=20200:
			tax1 = 1000 * 0
			value2 = 10000 - 1000
			tax2 = value2 * 0.1
			value3 = data[name] - 10000
			tax3 = value3 * 0.15
			app[name] =  tax1 + tax2 + tax3                                                                                                 return app
print(calculate_tax({"Darey":500, "Itua":9000}))


Что я уже пробовал:

def calculate_tax(данные):
приложение = {}
для имени в данных:
если data[name] >=0 и data[name] <= 1000:
значение = данные[имя] - 0
приложение[имя] = значение * 0
если data[name] >=1001 и data[name] <=10000:
tax1 = 1000 * 0
value2 = данные[имя] - 1000
tax2 = value2 * 0.1
приложение[имя] = tax1 + tax2
если data[name] >=10001 и data[name] <=20200:
tax1 = 1000 * 0
значение 2 = 10000-1000
tax2 = value2 * 0.1
value3 = данные[имя] - 10000
tax3 = value3 * 0,15
app[name] = tax1 + tax2 + tax3 return app
print (calculate_tax ({"Darey": 500, "Itua":9000}))

1 Ответов