Why For Loop Skips the Last element?

Mark Lawrence breamoreboy at yahoo.co.uk
Thu Jan 1 05:34:10 EST 2015


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
> TypeError.
>

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 :)

-- 
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.

Mark Lawrence




More information about the Python-list mailing list