📌  相关文章
📜  Python "for in" 循环打印列表中的最后一项 - Python 代码示例

📅  最后修改于: 2022-03-11 14:46:11.400000             🧑  作者: Mango

代码示例2
>>> total = 0
>>> for n in [5.99, 12.99, 20.99, 129.99]: 
        total += n
        print('Total is now', total)

Total is now 5.99
Total is now 18.98
Total is now 39.97
Total is now 169.96        
>>> total  
169.96