这是我的代码。我正在做一个开始行动。当我运行程序错误字符串浮动
,我可以把这些值,但是当我走出循环出现以下错误信息:
a + = float (input ("Enter the product cost"))
ValueError异常:无法将字符串转换为float:
能谁来帮帮我?
这里有云:
e = 0.25
f = 0.18
a = 0.0
while True:
a += float(input("Enter the product cost: "))
if a == "":
break
b = a*e
c = a*f
d = a+b+c
print ("tax: " + b)
print ("tips: " + c)
print ("Total: " + d)
你可以做'A_INPUT =浮动(输入( “输入产品成本”))' –