Advertisement
Dido09

Python - Count Input(Dict)

Nov 16th, 2021
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.14 KB | None | 0 0
  1. text = str(input('Enter text: '))
  2. my_dict = {}
  3. for c in text:
  4. my_dict[c] = text.count(c)
  5. print(my_dict)
  6.  
  7.  
  8. # counts elements in input
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement