title: Counting and Grouping function with Python (2.7)
body: <p><strong>I have tried the following function:</strong></p>
  
  <pre><code>def item_order(order):
      salads = order.count("salad")
      hamburgers = order.count("hamburger")
      waters = order.count("water")
      return "salad:{} hamburger:{} water:{}".format(salads, hamburgers, waters)
  </code></pre>
  
  <p>taken from ( <a href="https://stackoverflow.com/questions/34906570/counting-and-grouping-with-python">https://stackoverflow.com/questions/34906570/counting-and-grouping-with-python</a> ), 
  with these two orders:</p>
  
  <p>1st order = "salad water hamburger salad hamburger" <br>
  - then the function should returns "salad:2 hamburger:2 water:1"  <br> <br>
  2nd order = "hamburger water hamburger" <br>
  then the function should returns "salad:0 hamburger:2 water:1",  <br></p>
  
  <p>in <a href="http://www.pythontutor.com/visualize.html#mode=edit" rel="nofollow noreferrer">http://www.pythontutor.com/visualize.html#mode=edit</a></p>
  
  <p>But it seems it doesn't work.
  Maintaining this structure, what am I doing wrong?</p>
  
  <p>Many thanks for any help!!</p>