You are viewing a single comment's thread. Return to all comments →
char_count= {} for char in s: if char in char_count: char_count[char] += 1 else: char_count[char] = 1 char_count = sorted(char_count.items(), key=lambda item: item[0]) char_count = sorted(char_count, key=lambda item: item[1], reverse=True) for char in char_count[0:3]: print(char[0], char[1])
Seems like cookies are disabled on this browser, please enable them to open this website
Company Logo
You are viewing a single comment's thread. Return to all comments →