Advertisement
Guest User

Untitled

a guest
Apr 6th, 2020
185
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.38 KB | None | 0 0
  1. count = {}
  2. word = input("Write your phrase: ")
  3. word = word.lower()
  4. word = word.replace(".", " ").replace(",", " ")
  5. for sentence in word.split(" "):
  6.     if sentence != "":
  7.         if sentence in count:
  8.             count[sentence] += 1
  9.         else:
  10.             count[sentence] = 1
  11.     else:
  12.         pass
  13. for sentence in word.split():
  14.     print(sentence, ':', count[sentence])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement