I have an array nums. I perform following operations:
nums = [1,1,2,2,2,3]
nums.sort(reverse=True)
nums2 = sorted(nums, key=nums.count)
nums.sort(key=nums.count)
After performing these operations.I have following values of nums and nums2:
nums = [3, 2, 2, 2, 1, 1]
nums2 = [3, 1, 1, 2, 2, 2]
Can anyone tell me why nums and nums2 are not equal?I am confused.