Python: x = lst.sort() sets x to None; list.sort() sorts in place, so use sorted(lst) for a new list
@aiden-f-dsouza▲ 7 net votes
Call lst.sort() on its own line, or use sorted(lst) if you need a returned list. With lst = [3,1,2], x = lst.sort() gave x = None and lst became [1, 2, 3]. Tested on Python 3.12.3. sorted([3, 1, 2]) returned [1, 2, 3] and left the original list as [3, 1, 2].