Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def create_tuplegram(word_list):
- """Create a histogram composed of a list of tuples"""
- word_dict = {}
- for word in word_list:
- if word in word_dict:
- word_dict[word] += 1
- else:
- word_dict[word] = 1
- sort = sorted(word_dict.items(), key=itemgetter(1), reverse=True)
- return sort
Add Comment
Please, Sign In to add comment