Python Forum
[split] How to calculate tax with a variable input and if else
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[split] How to calculate tax with a variable input and if else
#1
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")
buran write Dec-28-2020, 06:50 AM:
Please, use proper tags when post code, traceback, output, etc. This time I have added tags for you.
See BBcode help for more info.
Reply
#2
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.
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  How to calculate tax with a variable input and if else afefDXCTN 12 22,807 Mar-15-2024, 01:58 AM
Last Post: nave
  New to Python - tiny coding assistance on user input function and assign to variable Mountain_Duck 1 2,497 Mar-23-2019, 06:54 PM
Last Post: Yoriz
  [split] Calculate Times dhodgens 3 2,838 Mar-03-2019, 09:30 PM
Last Post: micseydel
  How to make a dynamic variable based on input loltylerdowney 3 3,777 Nov-30-2017, 09:49 PM
Last Post: loltylerdowney

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020