I\'ve been able to verify that the findUniqueWords
does result in a sorted list
. However, it does not return the list. Why?
def fin
you can use sorted() method if you want it to return the sorted list. It's more convenient.
l1 = []
n = int(input())
for i in range(n):
user = int(input())
l1.append(user)
sorted(l1,reverse=True)
list.sort() method modifies the list in-place and returns None.
if you still want to use sort you can do this.
l1 = []
n = int(input())
for i in range(n):
user = int(input())
l1.append(user)
l1.sort(reverse=True)
print(l1)