Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save naemazam/b4a15622adb35fce74af7059d0769d41 to your computer and use it in GitHub Desktop.
Save naemazam/b4a15622adb35fce74af7059d0769d41 to your computer and use it in GitHub Desktop.
Write a python program a program to print letters in descending order of character occurrence frequency like example "google" output should be g-2 ,0 -2 , l- 1, b-1
love= input('enter a string ')
def rev(string):
d = dict()
for key in string:
if key not in d:
d[key] = 1
else:
d[key] += 1
return d
print (rev(love))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment