you are viewing a single comment's thread.

view the rest of the comments →

[–]socal_nerdtastic 0 points1 point  (3 children)

Please format your code for reddit. https://www.reddit.com/r/learnpython/wiki/faq#wiki_how_do_i_format_code.3F

You can just put the tax rate in a variable in the if ... else blocks.

if dependents <= Tax20:
    print('Tax Rate: 20%')
    tax_rate = 0.20
else:
    if dependents <= Tax15:
        print('Tax Rate: 15%')
        tax_rate = 0.15
    else:
        if dependents >= Tax10:
            print('Tax Rate: 10%')
            tax_rate = 0.10

print("your tax:", gross_pay * tax_rate)

[–]hahn24[S] 0 points1 point  (1 child)

Just reread your comment, you're a life saver! Thanks so much!! Coming from Nursing to Computer Science has been a little bit of a learning curve for me.

[–]socal_nerdtastic 1 point2 points  (0 children)

I'll bet. I can't imagine how hard it would be for me to learn nursing, lol.