you can user sorted..reverse as per doc

def main():
   print('Celebrities  known by one name:')
   drake = ['Drake']
   BE = ['Beyonce']
   RI = ['Rihanna']
   BO = ['Bono']

   a = input('Enter another one name celebrity ')
   b = input('Enter another one name celebrity ')
   c = input('Enter another one name celebrity ')
   d = [a,b,c,drake,BE,RI,BO]
   f = sorted(d,reverse=True)
   print('Celebrities in Reverse Alpha Order')
   for d in f:
      print(d)
main()
Answer from Dharmesh Fumakiya on Stack Overflow
🌐
Python.org
discuss.python.org › python help
Using sorted() to print a list in reverse alphabetical order - Python Help - Discussions on Python.org
August 10, 2021 - 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…
🌐
Quora
quora.com › How-do-you-sort-a-list-alphabetically-backwards-in-Python
How to sort a list alphabetically backwards in Python - Quora
You can user list.sort(reverse = True) in order to sort the list backwards. ... The new Acrobat Studio turns documents into dynamic workspaces. Adobe & CDW deliver AI for business.
Discussions

How can you use the sorted() function to print a list in reverse alphabetical order? (Python) - Stack Overflow
I'm a true newbie in Python. Using a learning book I've got this exercise among others. I do know how to do that with method, but not with a function sorted([, , , ] ). I've tried different appro... More on stackoverflow.com
🌐 stackoverflow.com
Python reverse alphabetical order - Stack Overflow
I have this output: [(3, 'one'), (2, 'was'), (2, 'two'), (1, 'too'), (1, 'racehorse'), (1, 'a')] and i need to make it so that the tuples with the same number are placed in reverse alphabetical More on stackoverflow.com
🌐 stackoverflow.com
January 11, 2017
python - How to sort a list by length and then in reverse alphabetical order - Stack Overflow
Now it sorts by "length and then in reverse alphabetical order" 2019-08-15T22:08:03.127Z+00:00 ... Please consider upvoting my answer and selecting it as accepted answer 2019-08-15T22:10:05.16Z+00:00 ... I learned with practice. There is a good book here: greenteapress.com/wp/think-python ... More on stackoverflow.com
🌐 stackoverflow.com
Sorting names in reverse alphabetic order
Just remove the third line of your code? More on reddit.com
🌐 r/learnpython
3
1
January 26, 2021
🌐
Spark By {Examples}
sparkbyexamples.com › home › python › python sort list alphabetically
Python Sort List Alphabetically - Spark By {Examples}
May 31, 2024 - By using the list.sort() function ... to specify the sorting criteria(s), reverse is a boolean value that specifies whether the list should be sorted in asc (False) or desc (True) order....
🌐
Replit
replit.com › home › discover › how to sort a list alphabetically in python
How to sort a list alphabetically in Python | Replit
February 13, 2026 - Setting reverse=True tells the function to arrange the list in descending alphabetical order—from Z to A—instead of the default ascending order.
🌐
Python Tutorial
pythontutorial.net › home › python basics › python sort list
How to Sort a List in Python Using the sort() Method
March 26, 2025 - Use the Python List sort() method to sort a list in place. The sort() method sorts the string elements in alphabetical order and sorts the numeric elements from smallest to largest. Use the sort(reverse=True) to reverse the default sort order. Was this tutorial helpful ?
🌐
codippa
codippa.com › home › how to sort a list in python
Python list sort | sort() & sorted() functions with examples
November 28, 2023 - Descending order for a numeric ... alphabetically is placed first. sort() function takes an argument with key as reverse and value as True or False where True indicates reverse sorting and False indicates sorting in ascending ...
Find elsewhere
🌐
Finxter
blog.finxter.com › home › learn python blog › how to sort a list alphabetically in python?
How to Sort a List Alphabetically in Python? - Be on the Right Side of Change
April 8, 2020 - However, my preferred method is ... book “Python One-Liners” with NoStarch Press (Amazon Link). You can reverse the order of the list by using the reverse keyword....
🌐
PyTutorial
pytutorial.com › alphabetize-list-in-python-easy-sorting-guide
PyTutorial | Alphabetize List in Python: Easy Sorting Guide
January 27, 2026 - # Example 4: Reverse alphabetical order animals = ["dog", "cat", "elephant", "bear"] reverse_sorted = sorted(animals, reverse=True) animals.sort(reverse=True) print("sorted() with reverse:", reverse_sorted) print(".sort() with reverse:", animals) sorted() with reverse: ['elephant', 'dog', 'cat', 'bear'] .sort() with reverse: ['elephant', 'dog', 'cat', 'bear'] You often need to sort lists containing more complex data, like tuples.
🌐
freeCodeCamp
freecodecamp.org › news › python-sort-list-how-to-order-by-descending-or-ascending
Python Sort List – How to Order By Descending or Ascending
September 3, 2021 - names = ["Jessica", "Ben", "Carl", "Jackie", "Wendy"] print("Unsorted: ", names) names.sort(reverse=True) print("Sorted: ", names) This method will return a new sorted list from an iterable. Examples of iterables would be lists, strings, and tuples. One key difference between sort() and sorted() is that sorted() will return a new list while sort() sorts the list in place. In this example, we have a list of numbers that will be sorted in ascending order.
🌐
Reddit
reddit.com › r/learnpython › sorting names in reverse alphabetic order
r/learnpython on Reddit: Sorting names in reverse alphabetic order
January 26, 2021 -

Sample output with input: 'Jan Sam Ann Joe Tod'

['Tod', 'Sam', 'Joe', 'Jan', 'Ann']

My code:

user_input = input()
short_names = user_input.split()

short_names = ['Jan', 'Sam', 'Ann', 'Joe', 'Tod']

short_names.sort(reverse=True)

print(short_names)

How do I edit the code to allow for any user input? For example I want to test with input 'Lew Sue Moe Al Jay'?

Thanks!

🌐
Altcademy
altcademy.com › blog › how-to-sort-a-list-alphabetically-in-python
How to sort a list alphabetically in Python - Altcademy.com
September 5, 2023 - When you run this code, Python will print out: ['apple', 'banana', 'cherry', 'kiwi']The items in the fruits list have been sorted in alphabetical order. Sometimes, you might want to sort the list in reverse order. Python has got you covered. The sort() method accepts an optional parameter called reverse.
🌐
W3Schools
w3schools.com › python › ref_list_sort.asp
Python List sort() Method
Sort the list by the length of the values and reversed:
🌐
TechBeamers
techbeamers.com › python-sort-lists-alphabetically
Python Program: How to Sort Lists Alphabetically
November 30, 2025 - This example demonstrates how to sort the list in reverse alphabetical order using the reverse parameter with the sorted() function.
🌐
Python documentation
docs.python.org › 3 › howto › sorting.html
Sorting Techniques — Python 3.14.3 documentation
February 23, 2026 - For example, list({'a', 'b'}) may produce either ['a', 'b'] or ['b', 'a']. For locale aware sorting, use locale.strxfrm() for a key function or locale.strcoll() for a comparison function. This is necessary because “alphabetical” sort orderings can vary across cultures even if the underlying alphabet is the same. The reverse parameter still maintains sort stability (so that records with equal keys retain the original order).
🌐
W3Schools
w3schools.com › python › ref_func_sorted.asp
Python sorted() Function
Remove List Duplicates Reverse a String Add Two Numbers · 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 ... 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.