【发布时间】:2013-05-28 05:53:36
【问题描述】:
我正在创建一个基本程序,该程序将使用 GUI 来获取商品的价格,然后如果初始价格低于 10,则减价 10%,如果初始价格低于 10,则减价 20%。初始价格大于十:
import easygui
price=easygui.enterbox("What is the price of the item?")
if float(price) < 10:
easygui.msgbox("Your new price is: $"(float(price) * 0.1))
elif float(price) > 10:
easygui.msgbox("Your new price is: $"(float(price) * 0.2))
我一直收到这个错误:
easygui.msgbox("Your new price is: $"(float(price) * 0.1))
TypeError: 'str' object is not callable`
为什么会出现这个错误?
【问题讨论】:
标签: python string user-interface comparison callable