sort method

Sort the contents of the list.

sortmethod1's photo

.sort(reverse=True) sorts in reverse order.

sortmethod2's photo

Lists containing numbers and letters cannot be sorted.

sortmethod3's photo

You can also sort characters.

sortmethod4's photo

You can also sort the characters in reverse order.

sortmethod5's photo

If uppercase and lowercase letters are involved, uppercase comes first.

sortmethod6's photo

If you want alphabetical order, use .sort(key=str.lower).

sortmethod7's photo