How do I sort a list of datetime or date objects ?
The function named list.sort() is yields nothing. It operates only in-place, but it modifies or make changes the list itself. All we need to call a.sort() without assign it a again.
We have another built in function called sorted(), that yields a list’s sorted version – a = sorted(a) will do everything that we need.