Listing 04-03: Income Tax Calculation

##############################################################################
# Python From Scratch
# Autor: Nilo Ney Coutinho Menezes
# Editora Novatec (c) 2010-2024
# Site: https://pythonfromscratch.com
#
# File: listing\chapter 04\04.03 - Income Tax Calculation.py
# Description: Income Tax Calculation
##############################################################################

salary = float(input("Enter the salary for tax calculation: "))
base = salary
tax = 0
if base > 3000:
    tax = tax + (base - 3000) * 0.35
    base = 3000
if base > 1000:
    tax = tax + (base - 1000) * 0.20
print(f"Salary: ${salary:6.2f} Tax payable: ${tax:6.2f}")
Click here to download the file