title: Using map (but not lambda) to update dict values in a list of dictionaries
body: <p>I'm stuck on a problem from a bootcamp prep course.  The problem wants me to use a function that takes in a dictionary as an argument, checks the type of the value of one of the keys, and then updates that value if the condition is met.  This function works great when it's given a specific list element from a list of dictionaries.</p>
  
  <p>The trouble comes when i try to nest this function into a map to apply the function to the entire list of dictionaries instead of passing in one specific element. </p>
  
  <p>I've tried giving the function as the first map argument without parentheses, as was demonstrated to me in the preceding materials, and then i've tried setting the iterator as the base list of dictionaries with no index, as a [:] slice, as a [0:len{list)] slice, as a [0:2] slice, all to no avail.  </p>
  
  <pre class="lang-py prettyprint-override"><code># list of dictionaries to be updated, trimmed to 3 for brevity
  
  restaurants = [{'name': 'Fork &amp; Fig',
    'price': '$$',
    'is_closed': False,
    'review_count': 610},
   {'name': 'Salt And Board',
    'price': '$$',
    'is_closed': False,
    'review_count': 11},
   {'name': 'Stripes Biscuit',
    'price': '$$',
    'is_closed': True,
    'review_count': 20}] 
  
  #function in question, changes the $ strings to numbers
  
  def format_restaurant(restaurant): 
      if type(restaurant['price']) == str:
          restaurant['price'] = len(restaurant['price'])
      return restaurant 
  
  # inputting a single dictionary entry works great:
  
  format_restaurant(restaurants[1]) # {'is_closed': False, 'name': 'Fork &amp; Fig', 'price': 2, 'review_count': 610}
  
  # Here comes the sticking point. The directions are: 
  #"Now write another function called map_format_restaurants using map, that 
  # uses above function and returns a list of restaurants with each of them 
  # formatted with price pointing to the respective number."
  
  # My answer that I think should work, but doesn't:
  
  def map_format_restaurants(restaurants):
      map(format_restaurant, restaurants)
      return restaurants
  
  # When this function is called, the list of dictionaries comes out just as it went in:
  
  map_format_restaurants(restaurants)
  </code></pre>
  
  <p>I want the code to change the '$' to 1 or the '$$' to 2 for each 'price' key value in the list of dictionaries, but none of them change.  No error messages are thrown.</p>
  
  <p>looking at the last dict entry in the list:</p>
  
  <pre><code> {'name': 'Stripes Biscuit',
    'price': '$$',
    'is_closed': True,
    'review_count': 20}] 
  </code></pre>
  
  <p>should have changed to:</p>
  
  <pre><code> {'name': 'Stripes Biscuit',
    'price': 2,
    'is_closed': True,
    'review_count': 20}] 
  </code></pre>
  
  <p>but instead came out just like it went in.</p>
  
  <p>I'm sure this is a nice softball for someone out there, but I can't seem to hit it.  Any insights would be greatly appreciated.</p>