fork download
  1. a = [4, 6, -2, -7, 0, 15, -22, 22, 23, 1]
  2.  
  3. print(sorted(a))
  4. print(sorted(a, key=lambda x: x*x))
  5.  
Success #stdin #stdout 0.02s 9052KB
stdin
Standard input is empty
stdout
[-22, -7, -2, 0, 1, 4, 6, 15, 22, 23]
[0, 1, -2, 4, 6, -7, 15, -22, 22, 23]