Movatterモバイル変換


[0]ホーム

URL:


Skip to content
DEV Community
Log in Create account

DEV Community

Isaac
Isaac

Posted on

Tax Calculator

We are going to make a simple program to calculate two different taxes based on the user's income. We are going to call this tax PIB.
First we set the variable for the yearly income that is going to cut between the two taxes:

citincut=85528
Enter fullscreen modeExit fullscreen mode

Second we define our variables for the two different tax operations base on the user's input:

print("Best rewards loyal citizen, today its time to contribute your Personal Income Tax for the Kingdom of Thalia.")citinput=float(input("Introduce Year Income:"))citix=citinput-citincut
Enter fullscreen modeExit fullscreen mode

We set the logic operation for the two different taxes.
As you can see for the people with a lower income than 85528 we are going to apply a tax of the 18% of the income minus 556.2:

if (citinput<=citincut):    tax=citinput*18/100-556.2    print(round(tax),"Is your annual PIT, thank you loyal citizen.\n")
Enter fullscreen modeExit fullscreen mode

To avoid having a negative tax we introduce a if statement:

    if (tax<=0):        print("Move Punk")
Enter fullscreen modeExit fullscreen mode

For the people with a higher income we are going to set a tax of 14839.2 plus 32% of the surplus over 85528:

elif (citinput>=citincut):    tax=citinput-(14839.2+(citix*32/100))    print(round(tax),"Is your annual PIT, Hail Thalia!\n")
Enter fullscreen modeExit fullscreen mode

You can change the value of the variable and use it for your own purposes.

Top comments(2)

Subscribe
pic
Create template

Templates let you quickly answer FAQs or store snippets for re-use.

Dismiss
CollapseExpand
 
ijosbuttler profile image
jacobhales
  • Joined

Thanks for sharing. Gonna try it for mycalculadoradeiva blog.

CollapseExpand
 
fasial_ali_879b685eade15c profile image
Fasial Ali
Hi, I'm Faisal Ali, a passionate web developer dedicated to crafting seamless and engaging web experiences. Always eager to learn and share knowledge about the latest web technologies. Let’s build som
  • Education
    FSC Pre Engeneering
  • Work
    Ceo on Faisal Web Dev
  • Joined

thank you man for sharing such type of information facing some issuing onWorms Zone Mod Apk but now its working really fine once again thank you from india

Some comments may only be visible to logged-in visitors.Sign in to view all comments.

Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment'spermalink.

For further actions, you may consider blocking this person and/orreporting abuse

Hello my name is Isaac and I'm a Cyber Security student!I will be uploading here all my work from College to University!
  • Joined

More fromIsaac

DEV Community

We're a place where coders share, stay up-to-date and grow their careers.

Log in Create account

[8]ページ先頭

©2009-2025 Movatter.jp