2018个人所得税计算python

def cal(money):
    if money<5000:
        return 0
    elif money<=8000:
        tax=(money-5000)*3/100
    elif money<=17000:
        tax=3000*3/100+(money-5000-3000)*0.1
    elif money<=30000:
        tax=3000*3/100+9000*0.1+(money-12000-5000)*0.2
    elif money<=40000:
        tax=3000*3/100+9000*0.1+13000*0.2+(money-25000-5000)*0.25
    elif money<=60000:
        tax=3000*3/100+9000*0.1+13000*0.2+10000*0.25+(money-35000-5000)*0.3
    elif money<=85000:
        tax=3000*3/100+9000*0.1+13000*0.2+10000*0.25+20000*0.3+(money-55000-5000)*0.35
    else:
        tax=3000*3/100+9000*0.1+13000*0.2+10000*0.25+20000*0.3+25000*0.35+(money-85000)*0.45
    return tax
n = int(sys.stdin.readline().strip())
for i in range(n):
    a = int(sys.stdin.readline().strip())
    result.append(cal(a))
for i in result:
    print(round(i+0.00001))

你可能感兴趣的:(python)