Course
Simulator
More
Premium
Log in
Python Function Reference
Functions
sort
sort
Sort the items of the list in place.
Python 3.13
list
.
sort
(
*
,
key
=
None
,
reverse
=
False
)
key
A function to serve as a key for the sort comparison.
reverse
Sort in reverse order.
Examples
Python 3.13
>>
>
a
=
[
3
,
1
,
2
]
>>
>
a
.
sort
(
)
[
1
,
2
,
3
]