Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- words = ["dangerous", "beware", "endanger", "beware", "danger", "Danger", "Beware", "Myself"]
- def length_count(words):
- counts = {}
- for word in words:
- if len(word) in counts:
- counts[len(word)] += 1
- else:
- counts[len(word)] = 1
- return counts
- print(length_count(words))
Add Comment
Please, Sign In to add comment