【发布时间】:2013-11-28 06:52:02
【问题描述】:
PizzaChange=float(input("What would you like the new price for all standard pizzas to be? "))
PriceList[0][1][2][3][4][5][6]=[PizzaChange]
PriceList[7][8][9][10][11]=[PizzaChange+3]
基本上我有一个输入,用户将输入一个数字值(浮点输入),然后它将所有上述列表索引设置为该值。出于某种原因,我无法在没有提出以下建议的情况下设置它们:
TypeError: 'float' object is not subscriptable
错误。我做错了什么还是我只是看错了?
【问题讨论】:
-
哪一行产生了错误?
-
我得到同样的错误:
TypeError: 'float' object is not subscriptable在这一行:print("%s: %.2f%%" % (model.metrics_names[0], scores[0]*100))从这段代码:machinelearningmastery.com/… 怎么了??
标签: python list replace insert indexing