how to sort a string list in python

fruits_list = ["orange", "mango", "kiwi", "pineapple", "banana"]

Here is what the above code is Doing:
1. We created a list of fruits.
2. We used the sort() method to sort the list.
3. We printed the list to see the result.

The output of the above code is:
[‘banana’, ‘kiwi’, ‘mango’, ‘orange’, ‘pineapple’]

As you can see, the list is now sorted in alphabetical order.

You can also sort a list in reverse alphabetical order by using the reverse=True argument.

Here’s an example: