Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # This function accepts a list of strings and return in a dictionary the keys as length of the strings and values representing how many
- # strings have the length
- # Declared list
- words = []
- # Function definition
- def length_count(words):
- # Using dictionary comprehension, iterate over each element in the list and return in a dictionary
- length = {len(word): letter.count(word) for word in words}
- print(length)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement