[("a", 2), ("b", 4), ("c", 5), ....]
sorted(array, key=lambda x: -x[1], x[0])
import string
latin_str2 = string.ascii_lowercase
latin_str_list = list(latin_str2)
print(latin_str_list)
print()
numbers = ("1","2","3","4","5","6","7","8","9","0")def check(text):
stroca = text.lower()
Lstr = list(stroca)
print(Lstr)
my_dict = {}
for value in Lstr:
if value in latin_str_list:
counts_0 = text.count(value)
my_dict[value] = counts_0
array = my_dict.items()
print(array)
answer = sorted( array, key = lambda x: x[-1]) # error
print('this is QA :',answer)
return(answer)
Всем добра!
def get_max(text):
count_map = {char:text.count(char) for char in set(text)}
return max(count_map, key=lambda char: count_map[char])