for items in things:
while inputFloat != 0:
thingsBack[][1]=inputFloat//things[]
inputFloat=inputFloat-(things[]*thingsBack[][1])
东西是n个元素的列表,而thingsBack是包含n个子列表的列表。我希望事物和事物都从第0个元素开始,并循环遍历递归。计算inputFloat // things []只改变thingsBack中第j个子列表的索引。我知道[]是无效的语法,但用于说明目的。python:在子列表的索引上运行循环
它似乎有一个明显的解决方案,但我没有看到它。
你可以添加样品输入的
things
要素是什么?你的预期产出可能是?你的问题有点不清楚。 – Lafexlos另外,如果'inputFloat'实际上是一个浮点数,那么它就不太可能是_exactly_零。 [浮点数学是否被破坏?](http://stackoverflow.com/questions/588004/is-floating-point-math-broken) – Lafexlos
你是什么意思的第j个子列表? – Learner