Advertisement
seroperson

Untitled

Sep 14th, 2020 (edited)
1,453
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.98 KB | None | 0 0
  1. frequency_distribution = {
  2.   "Beg": 1,
  3.   "Goddard's": 1,
  4.   "I": 3,
  5.   "them": 2,
  6.   "absent": 1,
  7.   "already": 1,
  8.   "alteration": 1,
  9.   "amazement": 2,
  10.   "appeared": 1,
  11.   "apprehensively": 1,
  12.   "associations": 1,
  13.   'clever': 1,
  14.   'clock': 1,
  15.   'composedly': 1,
  16.   'deeply': 7,
  17.   'do': 7,
  18.   'encouragement': 1,
  19.   'entrapped': 1,
  20.   'expressed': 1,
  21.   'flatterers': 1,
  22.   'following': 12,
  23.   'gone': 9,
  24.   'happening': 4,
  25.   'hero': 2,
  26.   'housekeeper': 1,
  27.   'ingratitude': 1,
  28.   'like': 1,
  29.   'marriage': 15,
  30.   'not': 25,
  31.   'opportunities': 1,
  32.   'outgrown': 1,
  33.   'playfully': 2,
  34.   'remain': 1,
  35.   'required': 2,
  36.   'ripening': 1,
  37.   'slippery': 1,
  38.   'touch': 1,
  39.   'twenty-five': 1,
  40.   'ungracious': 2,
  41.   'unwell': 1,
  42.   'verses': 1,
  43.   'yards': 5
  44. }
  45.  
  46. number_of_as = 0
  47.  
  48. def a_in_word(word, multiplier):
  49.   return len([x for x in word if x == 'a']) * multiplier
  50.  
  51. for k, v in frequency_distribution.items():
  52.   number_of_as += a_in_word(k, v)
  53.  
  54. print(number_of_as)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement