这个不知道哪里出了错误 按照上课讲的改了改但是程序报错了
有无专业人士解答
def count_tax(salary):
if salary<=5000:
tax=0
elif salary<=8000:
tax=(salary-5000)*0.03
elif salary<=12000:
tax=(salary-8000)*0.05+90
elif salary<=18000:
tax=(salary-12000)*0.1+200+90
return tax
def count_qita(listA):
for i in range(1,len(listA)):
listA[i][6]=eval(listA[i][3]+listA[i][4]+listA[i][5])
listA[i][6]=str(listA[i][6])
def count_gongzi(listA):
for i in range(1,len(listA)):
listA[i][7]=count_tax(eval(listA[i][6]))
listA[i][8]=eval(listA[i][6])-read_list_data[i][7]+eval(read_list_data[i][6])
listA[i][7]=str(listA[i][7])
listA[i][8]=str(listA[i][8])
return tax
def read_file(filename):
read_file=open(filename,'r',encoding='utf-8')
stringA=read_file.read()
return stringA
def pre_data(stringA):
listA=stringA.split('\n')
for i in range(len(listA)):
listA[i]=listA[i].split()
return listA
read_str=read_file('ygxx.txt')
read_list_data=pre_data(read_str)
count_qita(read_list_data)
count_gongzi(read_list_data)
工号 姓名 应发工资 岗位津贴 交通补贴 奖金 其他 所得税 实发工资
01 李明 7000 300 200 400 0 0
02 王阳 6000 280 210 300 0 0
03 张海 8000 290 430 200 0 0
04 刘鑫 5500 300 230 530 0 0
05 张三 6500 200 340 280 0 0
06 李四 5400 390 300 290 0 0
07 王五 7600 300 450 590 0 0
08 赵六 5800 490 340 470 0 0
09 王海 6800 300 340 340 0 0
10 刘洪 7800 340 530 200 0 0