Quick actions

cmd+k|ctrl+k

Navigation

Languages

21-May-2026 Lesson 10 (Additional 3) (Page 94)

Snippet info

Language

Python

Visibility

public

Author

michaelluiwaihung

Created

2026-05-21T13:07:15.509599Z

Updated

2026-05-24T13:48:22.98453Z

#https://glot.io/snippets/hi7p50jh0f

counter = 0
while counter < 5:
    counter += 1
    salary = input("input your salary")
    if salary == "":
        continue
    if not salary.isdigit():
        continue
    else:
        if int(salary) <= 50000:
            tax = int(salary) * 0.02
        elif int(salary) <= 100000:
            tax = 50000 * 0.02 + (int(salary) - 50000) * 0.05
        elif int(salary) <= 150000:     
            tax = 50000 * 0.02 + (50000) * 0.05 + (int(salary) - 100000) *.1     
        elif int(salary) <= 200000:     
            tax = 50000 * 0.02 + (50000) * 0.05 + 50000 * 0.1 + (int(salary) - 150000) *.15
        else:
            tax = 50000 * 0.02 + (50000) * 0.05 + 50000 * 0.1 + 50000 *0.15 +(int(salary) - 200000) *.25
        print(tax)    
INFO