Lists: Methods
Sorting
Syntax: list.sort()
E.g.
>>> l = [1, 3, 2.0, 4]
>>> l.sort()
>>> l
[1, 2.0, 3, 4]
>>> l=["c", "d", "a", "b"]
>>> l.sort()
>>> l
['a', 'b', 'c', 'd']
Previous slide
Next slide
Back to first slide
View graphic version