Please enable JavaScript.
Coggle requires JavaScript to display documents.
Python MIT Course (Functions (Decomposition and Abstraction, Docstring or…
Python MIT Course
Functions
-
-
map(function, iterables) # since functions are objects in Python, here we just apply the given function to each elements in the iterables (can be list of tuple), and return a new iterables
Data Structure
Tuple
('one',) # this is a tuple
-
-
range()
does not generate a tuple at first, instead, it just generate the first number, and then iterate over the function to generate the rest elements
List
-
-
sorted(L) # this will return a sorted L, but doesn't mutate "L"
Copy a list
-
It's very crucial to make a copy when you iterate over a list in a function, because the index might not match the original list if you make any change to the list.
If you append a alias of a list to another list, the appended list in the large list will still be altered if you change the original small list.
-
-
-