<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content="text/html; charset=utf-8" http-equiv=Content-Type>
<META name=GENERATOR content="MSHTML 11.00.9600.17496">
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT size=2 face=Arial>Not sure after quick skim/scan, but, I would
generally use either for I in range(len(inlist)): or just for it in inlist,
instead of using while, etc.</FONT></DIV>
<DIV><FONT size=2 face=Arial></FONT> </DIV>
<DIV><FONT size=2 face=Arial>Stay well</FONT></DIV>
<DIV><FONT size=2 face=Arial></FONT><FONT size=2 face=Arial></FONT><BR>Jacob
Kruger<BR>Blind Biker<BR>Skype: BlindZA<BR>"Roger Wilco wants to welcome
you...to the space janitor's closet..."<BR></DIV>
<BLOCKQUOTE
style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; PADDING-RIGHT: 0px; MARGIN-RIGHT: 0px">
<DIV style="FONT: 10pt arial">----- Original Message ----- </DIV>
<DIV
style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From:</B>
<A title=wasp52dex@gmail.com href="mailto:wasp52dex@gmail.com">Thuruv V</A>
</DIV>
<DIV style="FONT: 10pt arial"><B>To:</B> <A title=python-list@python.org
href="mailto:python-list@python.org">python-list@python.org</A> </DIV>
<DIV style="FONT: 10pt arial"><B>Sent:</B> Wednesday, December 31, 2014 11:25
PM</DIV>
<DIV style="FONT: 10pt arial"><B>Subject:</B> Why For Loop Skips the Last
element?</DIV>
<DIV><BR></DIV>
<DIV dir=ltr>
<DIV>Hi all,</DIV>
<DIV><BR></DIV>
<DIV>Here's the list. .</DIV>
<DIV><BR></DIV>
<DIV>
<DIV>inlist = ["Fossil Women's Natalie Stainless Steel Watch Brown
(JR1385)",</DIV>
<DIV>'Balmer Swiss Made Veyron Mens Watch: Black Band/ Black Dial
(62625241)',</DIV>
<DIV>'Fortune NYC Ladies Quilted Dial Watch: Brown',</DIV>
<DIV>'Jeanne Collection w/ Swarovski Elements Watch: Dark Purple Band
(62623659)',</DIV>
<DIV>'Swiss Legend Commander Chronograph: Watch Orange/Black
(SL-10067-01-ORS)',</DIV>
<DIV>'Debussy Ladies Watch: Brown/Gray/Silver 14070 - 62625292',</DIV>
<DIV>'#2 Swiss Legend Commander Chronograph: Green (SL-10067-BB-017)',</DIV>
<DIV>'Auguste Jaccard 3 Timezone Watch: Black Band/ Gray & Black Dial
(62625184)'</DIV>
<DIV>]</DIV></DIV>
<DIV><BR></DIV>
<DIV>My code :</DIV>
<DIV>i = 0</DIV>
<DIV>while i <= len(inlist):</DIV>
<DIV> if 'watch' in str(inlist[i]).lower() or 'watches' in
str(inlist[i]).lower():</DIV>
<DIV> if 'women' in str(inlist[i]).lower() or
'female' in str(inlist[i]).lower() or 'ladies' in
str(inlist[i]).lower():</DIV>
<DIV> print 'FEMale Watch',
inlist.index(i),str(i)</DIV>
<DIV> elif 'men' in str(inlist[i]).lower() or
'male' in str(inlist[i]).lower() or 'chronograph' in
str(inlist[i]).lower():</DIV>
<DIV> print 'Male
Watch',inlist.index(i),str(i)</DIV>
<DIV> i = next(inlist)</DIV>
<DIV><BR></DIV>
<DIV>When on executing python skips the last element('Auguste Jaccard 3
Timezone Watch: Black Band/ Gray & Black Dial (62625184)') in the
list.</DIV>
<DIV><BR></DIV>
<DIV>But when accessing through 'print inlist[0]' is possible,i.e it shows the
e;lement. but the list skips it. .<BR>Please enlighten me. .</DIV>
<DIV>Thanks.</DIV></DIV>
<P>
<HR>
<P></P>--
<BR>https://mail.python.org/mailman/listinfo/python-list<BR></BLOCKQUOTE></BODY></HTML>