daily pastebin goal
44%
SHARE
TWEET

Untitled

a guest Dec 7th, 2017 46 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. def create_tuplegram(word_list):
  2.     """Create a histogram composed of a list of tuples"""
  3.     word_dict = {}
  4.  
  5.     for word in word_list:
  6.         if word in word_dict:
  7.             word_dict[word] += 1
  8.         else:
  9.             word_dict[word] = 1
  10.  
  11.     sort = sorted(word_dict.items(), key=itemgetter(1), reverse=True)
  12.     return sort
RAW Paste Data
Top