这里的问题是什么?你知道吗
THREAD = 2.55
bags_value = input('Bags value in gold: ')
cloth_price = input('Cloth price in gold: ')
dust_price = input('Dust price in gold: ')
bags_cost = (2 * THREAD) + 6 * ((2 * dust_price) + 2 * (5 * cloth_price))
profit = bags_value - bags_cost
print(profit)
皮查姆喊道:
TypeError: unsupported operand type(s) for +: 'float' and 'str'
如果我从终端执行脚本,也会发生同样的情况。你知道吗
然而,它在ipython下工作得很好。水处理设施
input
返回string
。您必须转换到float
:相关问题 更多 >
编程相关推荐