Skip to content

Instantly share code, notes, and snippets.

@calthoff
Created April 10, 2018 03:33
Show Gist options
  • Select an option

  • Save calthoff/2a7637fbf65403f536fd4d52490ae283 to your computer and use it in GitHub Desktop.

Select an option

Save calthoff/2a7637fbf65403f536fd4d52490ae283 to your computer and use it in GitHub Desktop.
def count_characters(string):
count_dict = {}
for c in string:
if c in count_dict:
count_dict[c] += 1
else:
count_dict[c] = 1
print(count_dict)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment