Advertisement
Dammiejoy20

Untitled

Mar 8th, 2020
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.42 KB | None | 0 0
  1. # This function accepts a list of strings and return in a dictionary the keys as length of the strings and values representing how many
  2. # strings have the length
  3.  
  4. # Declared list
  5. words = []
  6. # Function definition
  7. def length_count(words):
  8. # Using dictionary comprehension, iterate over each element in the list and return in a dictionary
  9.     length = {len(word): letter.count(word) for word in words}
  10.     print(length)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement