📄️ Functions
Functions are the building blocks of modern programming. A function is a block of code that performs a specific task and can be reused throughout your program. Functions are defined using the def keyword. The def essentially just means "define". You are defining a task (a function) that can be executed later by your program. After writing the def keyword, you write the name of the function. It is important to name it something descriptive so that you can reference it later. A example of a function declaration is. Functions are important because they allow you to break down complex problems into smaller, manageable pieces. This makes your code more organized, easier to read, and easier to maintain.
📄️ Scopes and Lifetimes
A lifetime is the duration of time that a variable exists in memory. A scope is a region of code where a variable can be accessed. In Python, there are two main types of scopes: local and global.
📄️ Modules
A module is simply a file containing Python code that can define functions, classes, and variables. It is usually a collection of related functions and variables that you can use in your programs. These help you organize your programs and reuse code instead of writing it from scratch every time.