我一直收到这个错误:类型错误:当我尝试运行它时,int对象不可迭代错误。我似乎不明白为什么

时间:2016-10-13 07:15:23

标签: python-2.7 iterable

def calculate_tax(income_input):
  income_inpu = {}
  for item in income_input:
    tax = '0'
    income = income_input[item]      
    if income in range(0, 1001):
      tax = (0*income)
    if income in range(1001, 10001):
      tax = (0.1 * (income-1000))
    if income in range(10001, 20201):
      tax = ((0.1*(10000-1000)) + (0.15*(income-10000)))
    if income in range(20201, 30751):
      tax = ((0.1*(10000-1000)) + (0.15*(20200-10000)) + (0.2*(income-20200)))
    if income in range(30751, 50001):
      tax = ((0.1*(10000-1000)) + (0.15*(20200-10000)) + (0.2*(30750-20200)) + (0.25*(income-30750)))
    if (income > 50000):
      tax = ((0.1*(10000-1000)) + (0.15*(20200-10000)) + (0.2*(30750-20200)) + (0.25*(50000-30750)) + (0.3*(income-50000)))            
    income_inpu[item] = tax
  return income_inpu

0 个答案:

没有答案