Python Forum
[split] How to calculate tax with a variable input and if else - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: Homework (https://python-forum.io/forum-9.html)
+--- Thread: [split] How to calculate tax with a variable input and if else (/thread-31695.html)



[split] How to calculate tax with a variable input and if else - rokemas - Dec-28-2020

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")



RE: [split] How to calculate tax with a variable input and if else - buran - Dec-28-2020

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.