【发布时间】:2019-10-20 08:17:29
【问题描述】:
第 3 行,在
reduce_price=int(input("初始价格为:" ,age, "%"))
TypeError:最多输入 1 个参数,得到 3 个:
age=int(input("The age of the customer is : "))
initial_price=float(input("The initial price est : "))
reduced_price=int(input("The reduced price is : " ,age, "%"))
print("The price after reduction is", initial_price-reduced_price, "$")
【问题讨论】:
-
我不确定你打算在第 3 行做什么。对于
input(),你只能有一个参数,即它打印给用户的文本。您也有导致错误的,age, "%"。我不确定你想对年龄和 % 做什么。 -
你好@MyNameIsCaleb。对于年龄,我给你举个例子:如果一个 22 岁的客户会有 22% 的折扣。
-
谢谢,我为您添加了一个解决方案,让您可以在注释行中添加解释。
-
看起来在第 3 行你想使用 print 而不是 input