Skip to content

Instantly share code, notes, and snippets.

@amankharwal
Created March 12, 2021 07:26
Show Gist options
  • Save amankharwal/5edb163cf5f17b0a54c2dea27054d533 to your computer and use it in GitHub Desktop.
Save amankharwal/5edb163cf5f17b0a54c2dea27054d533 to your computer and use it in GitHub Desktop.
def count_characters(s):
count = {}
for i in s:
if i in count:
count[i] += 1
else:
count[i] = 1
print(count)
print(count_characters("Thecleverprogrammer"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment