import sys
taxes_table = ((0, 23), (17280, 28), (34560, 35), (51840, 40), (74030, 45), (102530, 46), (136670, 47), (199240, 49), (sys.maxsize, 49))
month_salary = 8563.45
year_salary = month_salary * 12
total_tax = 0
for tax_item1, tax_item2 in zip(taxes_table[:-1], taxes_table[1:]):
total_tax += (min(year_salary, tax_item2[0]) - tax_item1[0]) * tax_item1[1] / 100
if year_salary <= tax_item2[0]:
break
print(f'Total tax is {total_tax:.2f} (from {year_salary:.2f}) EUR per year. {year_salary:.2f} - {total_tax:.2f} = {year_salary - total_tax:.2f} EUR')
print(f'Monthly tax is {total_tax / 12:.2f} (from {month_salary:.2f}) EUR per month. {month_salary:.2f} - {total_tax / 12:.2f} = {month_salary - total_tax / 12:.2f} EUR')
print(f'Flat tax is {total_tax * 100 / year_salary:.2f} %')
Click Run or press shift + ENTER to run code