Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- my_string = "To Be or not To Be"
- my_dict = {}
- for word in my_string.split():
- my_dict[word] = my_dict.get(word, 0)+1
- for word in my_dict:
- print("%s occurs %d times."%(word,my_dict[word]))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement