1)这是错误消息:
Traceback (most recent call last):
File "script.py", line 14, in <module>
customer_one_tax = customer_one_total * sales_tax
TypeError: can't multiply sequence by non-int of type 'str'
2)这是一个变量:
sales_tax = '.088'
3)另一个变量CUSTOMER_ONE总计是最后一次更新的更新变量:
customer_one_total += luxurious_lamp_price
答案 0 :(得分:0)
好像sales_tax是一个字符串。 '.088'-> str
。也许尝试.088
答案 1 :(得分:0)
错误非常明显:
can't multiply sequence by non-int of type 'str'
您的sales_tax = '.088'
是string
而不是number
并且:
>>>3*'.88'
'.88.88.88'
>>>'3'*'.88'
Traceback (most recent call last):
File "/usr/lib/python3.6/code.py", line 91, in runcode
exec(code, self.locals)
File "<input>", line 1, in <module>
TypeError: can't multiply sequence by non-int of type 'str'
您的customer_one_total
似乎也不是“数字”
我的建议是float()
customer_one_total += float(luxurious_lamp_price)
customer_one_tax = customer_one_total * float(sales_tax)