title: Iterating over list of namedtuples, selecting restaurants
body: <p>I have a function that that returns restaurants with prices at or below a specified value. Here is my current code:</p>
  
  <pre><code>Restaurant = namedtuple('Restaurant', 'name cuisine phone menu')
  Dish = namedtuple('Dish', 'name price calories')
  
  r1 = Restaurant('Thai Dishes', 'Thai', '334-4433', [Dish('Mee Krob', 12.50, 500),
                                                  Dish('Larb Gai', 11.00, 450)])
  r2 = Restaurant('Taillevent', 'French', '01-44-95-15-01', 
              [Dish('Homard Bleu', 45.00, 750),
               Dish('Tournedos Rossini', 65.00, 950),
               Dish("Selle d'Agneau", 60.00, 850)])
  
  
  collection =[r1,r2]
  
  
  def Collection_is_cheap(C, price):
      result = []
      if not C:
         return ''
      else:
          for rest in C:
              for dish in rest.menu:
                  if dish.price &lt;= price:
                      result.append(rest)
      return result
  </code></pre>
  
  <p>But when I try to run it:</p>
  
  <pre><code>print(Collection_is_cheap(collection, 28))
  </code></pre>
  
  <p>I get is a long list of correct Restaurants, but repeated.</p>
  
  <pre><code>[Restaurant(name='Thai Dishes', cuisine='Thai', phone='334-4433', menu=[Dish(name='Mee Krob', price=12.5, calories=500), Dish(name='Larb Gai', price=11.0, calories=450)]), Restaurant(name='Thai Dishes', cuisine='Thai', phone='334-4433', menu=[Dish(name='Mee Krob', price=12.5, calories=500), Dish(name='Larb Gai', price=11.0, calories=450)]), Restaurant(name='Pascal', cuisine='French', phone='940-752-0107', menu=[Dish(name='Escargots', price=12.95, calories=250), Dish(name='Poached salmon', price=18.5, calories=550), Dish(name='Rack of lamb', price=24.0, calories=850), Dish(name='Marjolaine cake', price=8.5, calories=950)]), Restaurant(name='Pascal', cuisine='French', phone='940-752-0107', menu=[Dish(name='Escargots', price=12.95, calories=250), Dish(name='Poached salmon', price=18.5, calories=550), Dish(name='Rack of lamb', price=24.0, calories=850), Dish(name='Marjolaine cake', price=8.5, calories=950)]), Restaurant(name='Pascal', cuisine='French', phone='940-752-0107', menu=[Dish(name='Escargots', price=12.95, calories=250), Dish(name='Poached salmon', price=18.5, calories=550), Dish(name='Rack of lamb', price=24.0, calories=850), Dish(name='Marjolaine cake', price=8.5, calories=950)]), Restaurant(name='Pascal', cuisine='French', phone='940-752-0107', menu=[Dish(name='Escargots', price=12.95, calories=250), Dish(name='Poached salmon', price=18.5, calories=550), Dish(name='Rack of lamb', price=24.0, calories=850), Dish(name='Marjolaine cake', price=8.5, calories=950)])]
  </code></pre>
  
  <p>Whereas for the correct output it should only print the two restaurants once. How can I correct this, so that the function only returns:</p>
  
  <pre><code>[Restaurant(name='Thai Dishes', cuisine='Thai', phone='334-4433', menu=[Dish(name='Mee Krob', price=12.5, calories=500), Dish(name='Larb Gai', price=11.0, calories=450)]), Restaurant(name='Pascal', cuisine='French', phone='940-752-0107', menu=[Dish(name='Escargots', price=12.95, calories=250), Dish(name='Poached salmon', price=18.5, calories=550), Dish(name='Rack of lamb', price=24.0, calories=850), Dish(name='Marjolaine cake', price=8.5, calories=950)]
  </code></pre>