Advertisement
kevinbocky

most_populair.py

Jan 27th, 2019
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. #find a way to display the most populair item
  2. from collections import Counter #import Counter from collections
  3.  
  4. order_drinks = ["Tea","Coffee","Tea","Tea","Coffee","Hot Chocolate","Tea"] #this is the list
  5.  
  6.  
  7. i = Counter(order_drinks)#using a constructor to create a class item?
  8. print(i.most_common()) #display the most common value, in order from high to low
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement