In this tutorial, you will learn about python list sort wit example. Python has list methods and used to perform the frequency task occurring to list. The methods in the list are as follows:-
Sort ():-Sorts the elements of a given list in a specific order Ascending or Descending.
Syntax:-
List = [2.3, 4.445, 3, 1.054, 2.5]
Sorted (list)
Print (list)
O/p:-
[1.05, 2.3, 2.5, 3, 4.445]
example:-
List = [2, 4, 3, 5, 1, 7]
print(min(List))
O/p:-
1
Max ():-returns largest element.
Syntax:-
Max (list)
example:-
List = [2, 4, 3, 5, 1, 7]
print(max(List))
O/p:-
7
min ():-returns smallest element.
Syntax:-
min(list)
example:-
List = [2, 4, 3, 5, 1, 7]
print(min(List))
O/p:-
1