0
对不起,打扰你一个noob问题,但我是Python的新手。基本上这是一项家庭作业,我不明白我做错了什么。我想我拥有我需要的所有东西,但我仍然得到一个类型错误。任何帮助表示赞赏。谢谢!TypeError不受支持的操作数类型为%:Float和NoneType
def Main():
Weight = float(input ("How much does your package weigh? :"))
CalcShipping(Weight)
def CalcShipping(Weight):
if Weight>=2:
PricePerPound=1.10
elif Weight>=2 & Weight<6:
PricePerPound=2.20
elif Weight>=6 & Weight<10:
PricePerPound=float(3.70)
else:
PricePerPound=3.8
print ("The total shipping cost will be $%.2f") % (PricePerPound)
Main()
@MartijnPieters我认为你的意思是'按位'。 –
@SilasRay你可能会忽略_not_。 – devnull
我假设这是Python 3代码,对吧? – PearsonArtPhoto