Write a Python function that takes in a list of integers and returns a new list that contains only the unique elements of the original list, sorted in descending order by the number of times each element appears in the original list. If two or more elements appear the same number of times, they should be sorted in ascending order.

For example, given the list [1, 2, 2, 3, 3, 3, 4, 4, 4, 4], the function should return [4, 3, 2, 1].
Please enter comments
Please enter your name.
Please enter the correct email address.
You must agree before submitting.

Answers & Comments


Copyright © 2024 SCHOLAR.TIPS - All rights reserved.