List Sort in list is used to sort elements alphabetically or reverse of it as shown below.
Example of List.Sort
a=['apple', 'orange', 'mango', 'guavava'] when we apply sort it will be sorted alphabetically as shown below a.sort() a Output:['apple', 'guavava', 'mango', 'orange']
To sort reverse of it (Z To A) we will write as shown below
a.sort(reverse=True)
[…] List.sort: To sort a list alhapbatically (A to Z) and reverse of it (Z to […]