Python Lists continued
-
Refer Here for the python notebook
-
Reorder Items with sort() and sorted()
- The list method sort() with sort the list itself , in place
- The general function sorted() returns a sorted copy of the list
-
Copying the list with assignment
-
Copying the list with copy(), list() or slice
-
The copy() function works well if the list values are all immutable. A change in original will not reflect in the copies as long as values are immutable
-
But if we have items in a list which mutable (list in list) then change in original will be reflected in copies also
-
To fix this, we need use python standard library has a module copy which has a deepcopy() method
Problem 3 in project Euler
- Refer Here for the problem
- Refer Here