[Tutor] Skipping elements from inside generator loops

Scot W. Stevenson scot@possum.in-berlin.de
Sat, 3 Aug 2002 15:28:01 +0200


Hello Steve, 

> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> cat_list = [ cat for cat in procession if cat != 'ALARM!' and cat !=
> 'the evil dog' ] for cat in cat_list:
> 	print cat
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Ah, but this is cheating - you are looking for 'the evil dog' directly. You 
are only allowed to check for the alarm, not for the dog itself!

Y, Scot


-- 
  Scot W. Stevenson -- scot@possum.in-berlin.de -- Zepernick, Germany