Cheat Sheet

// +----------------------------------+----------------------------------+
| Basic Concepts & Data Structures | Advanced Concepts & Pythonic    |
|                                  | Concepts                        |
+----------------------------------+----------------------------------+
| **Variables and Data Types**     | **Object-Oriented Programming** |
| - int, float, str, bool          | - class, object                 |
| - Variables and assignment       | - init, self                    |
|   (=, +=, -=)                    | - Inheritance, Encapsulation,   |
|                                  |   Polymorphism                  |
+----------------------------------+----------------------------------+
| **Control Flow**                 | **Iterators and Generators**    |
| - if, else, elif                 | - yield: Generator functions   |
| - for, while                     | - iter, next: Iterators         |
| - break, continue                | **List Comprehensions and       |
| - try, except, finally, raise    |   Generators**                  |
|                                  | - Concise creation of lists and |
|                                  |   generators                    |
+----------------------------------+----------------------------------+
| **Functions and Modules**        | **Decorators and Context        |
| - def: Function definition       |   Managers**                    |
| - return: Function return values | - @: Decorator syntax           |
| - import, from, as               | - with: Context managers        |
+----------------------------------+----------------------------------+
| **Lists**                        | **Lambda Functions**            |
| - Indexing, slicing              | - Anonymous functions           |
| - Methods: append, remove, pop,  |                                 |
|   extend, sort                   | **Comprehensions (List,         |
+----------------------------------+ |   Dictionary, Set)**           |
| **Dictionaries**                 | - Slicing                       |
| - Usage: {key: value} pairs      | - Unpacking                     |
| - Methods: keys, values, items,  | - The Zen of Python: import this|
|   get, update                    |                                 |
+----------------------------------+----------------------------------+
| **Tuples and Sets**              |                                 |
| - Tuples: Immutable              |                                 |
| - Sets: add, remove, union,      |                                 |
|   intersection                   |                                 |
+----------------------------------+----------------------------------+

Last updated