Why For Loop Skips the Last element?
steve+comp.lang.python at pearwood.info
Thu Jan 1 13:38:17 CET 2015
Mark Lawrence wrote:
> On 01/01/2015 10:15, Steven D'Aprano wrote:
>> I know that the code you show cannot possibly be the code you are using,
>> because the code you show fails. If you ran this code, it would raise
> Traceback (most recent call last):
> File "C:\Users\Mark\Documents\MyPython\mytest.py", line 16, in <module>
> print('FEMale Watch', inlist.index(i),str(i))
> ValueError: 0 is not in list
> Sinner, but as it's New Year's Day I'll let you off :)
I was thinking of the next(inlist).
More information about the Python-list