在python中,我收到此错误TypeError:'> ='在'function'和'int'的实例之间不受支持

时间:2017-10-25 02:30:05

标签: python-3.x

到目前为止我的代码:

def book_point():
      displayoints = 0
      books = 0
      setmessage()
      books = bookinput()
      displayoints = display(bookinput)

    def setmessage():
      print ("Hello, please enter the number of books that you has purchased this month and we will displays the points awarded you have")

    def bookinput():
      books = 0
      books = int(input("Enter number: "))
      return books

    def display(bookinput):
      if bookinput == 0:
       print ("You have 0 point")
      elif bookinput == 1:
       print ("You have 5 points awarded")
      elif bookinput == 2:
       print ("You have 15 points awarded")
      elif bookinput == 3:
       print ("You have 30 points awarded")
      elif bookinput >= 4:
        print ("You have 60 points awarded")
      else:
       print ("Invalid number")
    book_point()

并且在执行时,它会说Traceback(最近一次调用最后一次):   文件“python”,第29行,in   在book_point中输入“python”,第6行   文件“python”,第25行,显示 在'function'和'int'

的实例之间不支持TypeError:'> ='

1 个答案:

答案 0 :(得分:0)

没关系,我得到了答案

def book_point():
  displayoints = 0
  books = 0
  setmessage()
  books = bookinput()
  displayoints = display(books)

def setmessage():
  print ("Hello, please enter the number of books that you has purchased this month and we will displays the points awarded you have")

def bookinput():
  books = 0
  books = int(input("Enter number: "))
  return books

def display(books):
  if books == 0:
    print ("You have 0 point")
  elif books == 1:
    print ("You have 5 points awarded")
  elif books == 2:
    print ("You have 15 points awarded")
  elif books == 3:
    print ("You have 30 points awarded")
  elif books >= 4:
    print ("You have 60 points awarded")
  else:
    print ("Invalid number")
book_point()