Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- frequency_distribution = {
- "Beg": 1,
- "Goddard's": 1,
- "I": 3,
- "them": 2,
- "absent": 1,
- "already": 1,
- "alteration": 1,
- "amazement": 2,
- "appeared": 1,
- "apprehensively": 1,
- "associations": 1,
- 'clever': 1,
- 'clock': 1,
- 'composedly': 1,
- 'deeply': 7,
- 'do': 7,
- 'encouragement': 1,
- 'entrapped': 1,
- 'expressed': 1,
- 'flatterers': 1,
- 'following': 12,
- 'gone': 9,
- 'happening': 4,
- 'hero': 2,
- 'housekeeper': 1,
- 'ingratitude': 1,
- 'like': 1,
- 'marriage': 15,
- 'not': 25,
- 'opportunities': 1,
- 'outgrown': 1,
- 'playfully': 2,
- 'remain': 1,
- 'required': 2,
- 'ripening': 1,
- 'slippery': 1,
- 'touch': 1,
- 'twenty-five': 1,
- 'ungracious': 2,
- 'unwell': 1,
- 'verses': 1,
- 'yards': 5
- }
- number_of_as = 0
- def a_in_word(word, multiplier):
- return len([x for x in word if x == 'a']) * multiplier
- for k, v in frequency_distribution.items():
- number_of_as += a_in_word(k, v)
- print(number_of_as)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement