应该为整数的值变为NoneType

时间:2018-10-23 15:55:25

标签: python

if data["level"] == 4:
  from levels import level_004 as level
  levelreturn = level.level(data)
  addMoney = investSub.tract(levelreturn,data["investorShare"])
  data["money"] += addMoney

investSub.tract()函数中为什么出现此错误?

Traceback (most recent call last):
  File "main.py", line 101, in <module>
    addMoney = investSub.tract(levelreturn,data["investorShare"])
  File "/home/runner/investSub.py", line 3, in tract
    total = subtotal*netshare
TypeError: unsupported operand type(s) for *: 'NoneType' and 'float'

Levelreturn始终返回整数,因此我似乎找不到问题。我检查了其他问题,但这没有用。如果需要,我可以提供更多代码。

编辑:

#level_004.py
import shortcuts as s
def level(saveF):
  s.qp("You and Miranda start selling lemonade to people.")
  if saveF["recipe"] == 0:
    f = 100
    return f
  elif saveF["recipe"] == 1:
    f = 200
    return f
  elif saveF["recipe"] == 2:
    f = -50
    return f
  elif saveF["recipe"] == 3:
    f = 115
    return f

还有其他问题让我知道。

0 个答案:

没有答案