import math name = input("Enter your name: ") taxableIncome = float(input(f"Hi {name}, please enter your taxable income: ")) #round the users income to the lowest whole number taxableIncome = math.floor(taxableIncome) # if statement to dtermine the appropriate tax: if taxableIncome>=0 and taxableIncome<=18200: print(f"{name} has a taxable income of ${taxableIncome}, whith a total amount of $0 tax due.") elif taxableIncome >= 18201 and taxableIncome <= 45000: tax= 0.19*(taxableIncome - 18200) print(f"{name} has a taxable income of ${taxableIncome},with total amount of ${round(tax,2)} tax due.") elif taxableIncome >= 45001 and taxableIncome<= 120000: tax = 5092+ 0.325*(taxableIncome - 45000) print(f"{name} has a taxable income of ${taxableIncome},with total amount of ${round(tax,2)} tax due.") elif taxableIncome>= 120001 and taxableIncome<= 180000: tax = 29.467+0.37*(taxableIncome - 120000) print(f"{name} has a taxable income of ${taxableIncome},with total amount of ${round(tax,2)} tax due.") else: tax = 51667+0.45*(taxableIncome - 180000) print(f"{name} has a taxable income of ${taxableIncome},with total amount of ${round(tax,2)} tax due.")
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter