Предмет:
ИнформатикаАвтор:
roscoe85def unique_sorted_descending(input_list):
# create a dictionary to store the count of each element
count_dict = {}
for num in input_list:
if num in count_dict:
count_dict[num] += 1
else:
count_dict[num] = 1
# sort the elements based on count and then by value
sorted_list = sorted(count_dict.items(), key=lambda x: (-x[1], x[0]))
# return the sorted list of unique elements
return [elem[0] for elem in sorted_list]
Автор:
juliaydsfThis function first creates a dictionary to store the count of each element in the input list. It then uses the sorted function to sort the dictionary items by count (in descending order) and then by value (in ascending order). Finally, it returns a list of the sorted unique elements.
Автор:
wizardmgzvДобавить свой ответ
Предмет:
МатематикаАвтор:
ozОтветов:
Смотреть
Предмет:
ГеографияАвтор:
valeriecastilloОтветов:
Смотреть
Предмет:
ИсторияАвтор:
casonfrancoОтветов:
Смотреть