Modules · List Comprehensions · OOP · pip Packages · Mini Projects · Quiz
import loads a module;
from X import Y pulls in just what you need. No installation required — these are built in.
math.sqrt(). The second imports just that one
name so you can call sqrt() directly. Both work; use from when you only need one or
two things.[expression for item in iterable if condition]. It replaces 3–5 lines of loop code with one
readable line.
x*2, for every x in numbers, but only if x > 5." The
if part is optional — leave it out to transform every item.
__init__ runs automatically when you create a new
instance.self as its first parameter — Python passes it automatically. self.name stores an
attribute on the object; a plain name inside the method is just a local variable that disappears.
BankAccount class with a balance, deposit/withdraw methods, and a
guard against overdrafts. Create multiple accounts and call their methods independently.pip is Python's package installer. It downloads packages from PyPI (Python Package Index) — over 500,000 packages
for everything from web scraping to machine learning.python -m venv venv then activate it. This keeps your project's dependencies isolated from
other projects and from the system Python. It's a professional habit worth building from day one.