W3Schools
w3schools.com › python › ref_list_reverse.asp
Python List reverse() Method
Python Certificate Python Training ... The reverse() method reverses the sorting order of the elements. ... The built-in function reversed() returns a reversed iterator object. ... If you want to use W3Schools services as an educational ...
W3Schools
w3schools.com › python › ref_func_sorted.asp
Python sorted() Function
The sorted() function returns a sorted list of the specified iterable object. You can specify ascending or descending order. Strings are sorted alphabetically, and numbers are sorted numerically.
Using sorted() to print a list in reverse alphabetical order
Can anyone help me use sorted() to print a list in reverse alphabetical order please? Here is my list: places = [‘Iceland’, ‘Japan’, ‘Manchester’, ‘Norwich’] As I understand it, the sorted() function can also accept a… More on discuss.python.org
How to use sorted () function with reverse=True.
You can refer to the documentation for other use cases but you can simply use it like sorted_list = sorted(original_list, reverse=True) More on reddit.com
Videos
10:06
How to Order Lists in Python (Visually Explained) | sort(), sorted(), ...
07:09
Sorting and Reversing a list| Python for Beginners | Module 03 ...
03:59
Python list sort, sorted, and reverse (CS105 at UIUC) - YouTube
List.sort(), Sorted(list), List.reverse(), sort(reverse=True), ...
14 The reverse and sort Methods
W3Schools
w3schools.com › python › ref_list_sort.asp
Python List sort() Method
Sort the list by the length of the values and reversed:
Python documentation
docs.python.org › 3 › howto › sorting.html
Sorting Techniques — Python 3.14.3 documentation
February 23, 2026 - Interestingly, that effect can be simulated without the parameter by using the builtin reversed() function twice: >>> data = [('red', 1), ('blue', 1), ('red', 2), ('blue', 2)] >>> standard_way = sorted(data, key=itemgetter(0), reverse=True) >>> double_reversed = list(reversed(sorted(reversed(data), key=itemgetter(0)))) >>> assert standard_way == double_reversed >>> standard_way [('red', 1), ('red', 2), ('blue', 1), ('blue', 2)]
W3Schools
w3schoolsua.github.io › python › python_lists_sort_en.html
Python Sort Lists. Lessons for beginners. W3Schools in English
Python Examples Python Compiler Python Exercises Python Quiz Python Certificate ... thislist = ["orange", "mango", "kiwi", "pineapple", "banana"] thislist.sort() print(thislist) Try it Yourself » ... thislist = ["orange", "mango", "kiwi", "pineapple", "banana"] thislist.sort(reverse = True) print(thislist) Try it Yourself »
W3Schools
w3schools.com › python › python_lists_sort.asp
Python - Sort Lists
Python Examples Python Compiler Python Exercises Python Quiz Python Challenges Python Server Python Syllabus Python Study Plan Python Interview Q&A Python Bootcamp Python Certificate Python Training ... thislist = ["orange", "mango", "kiwi", "pineapple", "banana"] thislist.sort() print(thislist) Try it Yourself » ... thislist = ["orange", "mango", "kiwi", "pineapple", "banana"] thislist.sort(reverse = True) print(thislist) Try it Yourself »
Programiz
programiz.com › python-programming › methods › built-in › sorted
Python sorted()
# sort the vowels print('Sorted Vowels:', sorted(vowels_list)) # Output: Sorted Vowels: ['a', 'e', 'i', 'o', 'u'] ... We can use an optional reverse parameter to sort the list in descending order.
Python W3schools
pythonw3schools.com › home › python sorted reverse
Python Sorted Reverse - Python W3schools
March 25, 2023 - We then used the sorted() function to sort the characters in the string in reverse order by passing reverse=True as an argument. The sorted characters are then concatenated using the join() function to create a reversed string. The reversed string is stored in the variable reversed_string, ...
Top answer 1 of 7
603
This will give you a sorted version of the array.
sorted(timestamps, reverse=True)
If you want to sort in-place:
timestamps.sort(reverse=True)
Check the docs at Sorting HOW TO
2 of 7
430
In one line, using a lambda:
timestamps.sort(key=lambda x: time.strptime(x, '%Y-%m-%d %H:%M:%S')[0:6], reverse=True)
Passing a function to list.sort:
def foo(x):
return time.strptime(x, '%Y-%m-%d %H:%M:%S')[0:6]
timestamps.sort(key=foo, reverse=True)
Programiz
programiz.com › python-programming › methods › list › sort
Python List sort()
Become a certified Python programmer. Try Programiz PRO! ... The list's sort() method sorts the elements of a list. ... # sort the list in ascending order prime_numbers.sort() print(prime_numbers) # Output: [2, 3, 5, 7, 11] ... We can sort a list in descending order by setting reverse to True.
W3Schools Blog
w3schools.blog › home › reverse array python
reverse array python - W3schools
July 1, 2022 - # method 1 arr = [11, 22, 33, 44, 55] res = arr[::-1] print("Reversed array:",res) #Reversed array: [5, 4, 3, 2, 1] #method 2 arr = [11, 22, 33, 44, 55] arr.reverse() print("After reversing Array:",arr) #After reversing Array: [55, 44, 33, 22, 11] #method 3 arr = [12, 34, 56, 78] result=list(reversed(arr)) print("Resultant new reversed Array:",result) #Resultant new reversed Array: [78, 56, 34, 12]
Cach3
w3schools.com.cach3.com › python › ref_func_sorted.asp.html
Python sorted() Function - W3Schools
Python Examples Python Exercises Python Quiz Python Certificate ... The sorted() function returns a sorted list of the specified iterable object. You can specify ascending or descending order. Strings are sorted alphabetically, and numbers are sorted numerically. Note: You cannot sort a list that contains BOTH string values AND numeric values. ... a = ("h", "b", "a", "c", "f", "d", "e", "g") x = sorted(a, reverse=True) print(x) Try it Yourself »
Reddit
reddit.com › r/pythonlearning › how to use sorted () function with reverse=true.
r/PythonLearning on Reddit: How to use sorted () function with reverse=True.
June 5, 2025 -
I'm learning python on my own and got the "Python Crash Course" book and I'm stuck on trying to sort a list in reverse using the sorted () function.