l = [1, 2, 'Hello', 10] l2 = sorted(l) print(l2) # [1, 2, 10, 'Hello'] l.sort() print(l) # [1, 2, 10, 'Hello']
l = [1, 2, 'Hello', 10] #l2 = sorted(l) # throw TypeError l.sort() # throw TypeError l = [1, 2, 5, 3] l2 = sorted(l) # [1, 2, 3, 5] l.sort() # [1, 2, 3, 5]