Python Sort List Using Function Javascript W3schools