Created
October 16, 2021 17:58
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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