fonction sorted python code example Example 1: tri python >>> sorted([5, 2, 3, 1, 4]) [1, 2, 3, 4, 5] Example 2: sorted python var = sorted(old_var)