Python Forum
How to calculate tax with a variable input and if else
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to calculate tax with a variable input and if else
#9
# This how I resolve your code
income = float(input("Enter the annual income: "))

if 3090.0 < income <= 85528.0  : # this income of 3090.0; came from this equation tax=0;which equal to (0.18 * income)=556.2

        tax= ((0.18 * income) - 556.2)

elif income > 85528.0 :

        tax= 0.32*(income - 85528.0)+ 14839.2  

else:
    tax=0
#
# Write your code here.
#

tax = round(tax, 0)
print("The tax is:", tax, "thalers")
Larz60+ write Jul-21-2021, 03:44 PM:
Please post all code, output and errors (it it's entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button.

fixed for you this time. Please use bbcode tags on future posts
Reply


Messages In This Thread
RE: How to calculate tax with a variable input and if else - by Kivans - Mar-13-2021, 09:47 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  [split] How to calculate tax with a variable input and if else rokemas 1 2,124 Dec-28-2020, 06:53 AM
Last Post: buran
  New to Python - tiny coding assistance on user input function and assign to variable Mountain_Duck 1 2,511 Mar-23-2019, 06:54 PM
Last Post: Yoriz
  How to make a dynamic variable based on input loltylerdowney 3 3,793 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