SHARE
TWEET

Untitled

a guest Apr 23rd, 2019 74 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. my_string = "To Be or not To Be"
  2. my_dict = {}
  3. for word in my_string.split():
  4.     my_dict[word] = my_dict.get(word, 0)+1
  5. for word in my_dict:
  6.     print("%s occurs %d times."%(word,my_dict[word]))
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top