Advertisement
matisarnowski

zliczanie_slow.py

Jul 8th, 2019
174
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.29 KB | None | 0 0
  1. import pprint
  2.  
  3. def zliczanie(message):
  4.     slownik = {}
  5.  
  6.     for znaki in message:
  7.         slownik.setdefault(znaki, 0)
  8.         slownik[znaki] = slownik[znaki] + 1
  9.  
  10.     return slownik
  11.  
  12. message = input("Podaj dowolnej długości tekst. ")
  13.  
  14. efekt = zliczanie(message)
  15.  
  16. pprint.pprint(efekt)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement