遍历浮动列表

2024-06-09 20:49:38 发布

您现在位置:Python中文网/ 问答频道 /正文

我有一个浮点数列表,我需要遍历它并找出最后4个数中的最低值

list = [1.1344, 1.254, 1.654, 1.2335, 1.43545]`

for i in list [-4]:

    print i

但我一直在想:

TypeError: 'float' object is not iterable

Tags: in列表forobjectisnotfloatiterable