我对Python相当陌生。我正在制作一台发电机,让面包店估计,如果他们制作纸杯蛋糕,会举办一个活动需要多少时间。不顺心的事在这里虽然为什么要返回Nonetype?
Batches = print("Batches of Cupcakes:", math.ceil(People * Ingredients/12))
Labor = print("Hours of labor:", Batches * 1.25)
我收到此错误:
TypeError: unsupported operand type(s) for *: 'NoneType' and 'float'
'print'不返回任何东西,所以'Batches'是'NoneType' –
迂腐:从技术上说,' Batches'是'None',它是'NoneType'类型的唯一实例,'Batches'不是它自己的类型。 – ShadowRanger
尝试:'type(Batches)' –