mò
THEc           @   s   d  „  Z  d „  Z d S(   c         C   s*   x# | D] } |  | ƒ o | Sq q Wd S(   sa  
    Return first item in sequence where f(item) == True.

    Example 1:
    >>> find( IsPrime , [ 4, 9, 13, 17 ] )
    13
    
    Example 2, using a function defined on the fly with 'lambda':
      to find in the list 'codewords' the first element
      whose attribute 'index' is equal to s,
    >>> co = find(lambda p: p.index == s, codewords)
    N(   t   seqt   itemt   f(   R   R    R   (    (    t   find1.pyt   find   s
      c         C   s7   x0 t  d |  ƒ D] } |  | d j o t Sq q Wt S(   sC   
    >>> IsPrime( 5 )
    True
    >>> IsPrime( 10 )
    False
    i   i    N(   t   ranget   nt   it   Falset   True(   R   R   (    (    R   t   IsPrime   s      N(   R   R
   (   R
   R   (    (    R   t   ?   s   	
