Python Forum

Full Version: [split] How to calculate tax with a variable input and if else
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hey afefDXCTN

First of all Im very glad I'm not the only one who's struggling with (easy) labs in python.

Here is my code though its not complete I can't get my head around second part with 32% but some of it comes with the right answer.

If you will complete the code let me know

income = float(input("Enter the annual income: "))

pit = (85528 / 100 * 18) - 556.02

if income <= 85528:
    tax = (income / 100 * 18) - 556.02
    tax = round(tax, 0)
    print("The tax is:", tax, "thalers")

elif income >= 85528:
   tax = (income - pit) / 100 * 32 + pit
   tax = round(tax, 0)
   print("The tax is:", tax, "thalers")

elif income < 1000:
    tax = 0
    tax = round(tax, 0)
    print("The tax is:", tax, "thalers")
Please, don't hijack threads.
the last elif will never be executed, because if income < 1000, then the if block (income <= 85528) will be executed.