Python Reference Guide
Basic Concepts:
Variables and Data Types
int, float, str, bool
Variables and assignment (=, +=, -=)
Control Flow
if, else, elif: Conditional statements
for, while: Loop constructs
break, continue: Loop control
try, except, finally, raise: Exception handling
Functions and Modules
def: Function definition
return: Function return values
import, from, as: Module importation
Data Structures:
Lists
Indexing, slicing
Methods: append, remove, pop, extend, sort
Dictionaries
Usage: {key: value} pairs
Methods: keys, values, items, get, update
Tuples and Sets
Tuples: Immutable
Sets: add, remove, union, intersection
Advanced Concepts:
Object-Oriented Programming
class, object
init, self
Inheritance, Encapsulation, Polymorphism
Iterators and Generators
yield: Generator functions
iter, next: Iterators
List Comprehensions and Generators
Concise creation of lists and generators
Decorators and Context Managers
@: Decorator syntax
with: Context managers
Lambda Functions
Anonymous functions
Pythonic Concepts:
Comprehensions (List, Dictionary, Set)
Slicing
Unpacking
The Zen of Python: import this
Remember: Python is an evolving language. Keep up-to-date with the latest versions and best practices.
Last updated