Controls and Functions
Variables and Argument Passing
When assigning a variable (or name) in Python, you are creating a reference to the object shown on the righthand side of the equals sign. Consider list of integers.
Conditionals
Loops
While Loop
Range
enumerate
It's common when iterating over a sequence to want to keep track of the index of the current item.
sorted
The sorted function returns a new sorted list from the elements of any sequence
zip
zip "pairs" up the elements of a number of lists, tuples, or other sequences to create a list of tuples.
reversed
reversed iterates over the elements of a sequence in a reverse order
Lambda Function
Python has support for so-called anonymous functions, which are a way of writing functions consisting of a single statement, the. result of which is the return value. They are defined with the lambda keyword, which has no meaning other than "we are declaring an anonymous function"
Files and OS
To open a file for reading or writing, use the built-in open functions with either a relative or absolute file path and an optional file encoding.