SHARE
TWEET

Untitled

a guest Aug 23rd, 2019 67 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import pprint
  2. message = 'This is a sentence from which we will count the characters'
  3. count = {}
  4.  
  5. for char in message.upper():
  6.     count.setdefault(char, 0)
  7.     count[char] += 1
  8. pprint.pprint(count)
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
 
Top