Python Tax US Calculator

brackets = [0, 11925, 48475, 103350]

rates = [0.1, 0.12, 0.22]


salary = float(input('please enter salary: '))



for i, bracket in enumerate(brackets[1:]):

    # print(i)

    # print(rates[i])

    tax1 = bracket - brackets[i] # max amount you pay in current bracket

    tax2 = salary - brackets[i] # amount you'd pay IF your salary falls in the current bracket

    baseAmount = max(min(tax1, tax2), 0)

    # Min function returns max amount IF your salary exceeds current bracket, and the other amount if you are in the current bracket

    if brackets < 103350:

        print('')

    # Max function returns 0 if you below the current bracket

    

    print(tax1)

    print(tax2)


0 Kudos

Comments

Displaying 0 of 0 comments ( View all | Add Comment )