FREE PYTHON COURSE
Free Python Course: Zero to Interview-Ready
Learn Python from your first line of code to the patterns coding interviews ask about. Every lesson is interactive: write the code in your browser and check each step as you go. Try the first step of any lesson free, no sign-up needed.
PART 1
Learn to code
Coding fundamentals, from your first line of code to solving problems on your own: loops, lists, strings, functions and the basics of classes.
Welcome To Python
Variables
Calculations With Numbers
Functions I
- Functions
- Defining Functions: Buggy Code
- Defining Functions: Quiz
- Calling Functions: Buggy Code
- Calling Functions: Quiz
- Indentation & Execution Flow
- Indentation & Execution Flow: Quiz I
- Indentation & Execution Flow: Quiz II
- Indentation & Execution Flow: Buggy Code
- Why Functions
- Exercise: Create a Function
- Function Parameters & Arguments
- Parameters & Arguments: Buggy Code I
- Parameters & Arguments: Buggy Code II
- Why Parameters & Arguments
- Exercise: Create Function With Parameters
- Returning From Functions
- Returning From Functions: Quiz I
- Returning From Functions: Buggy Code I
- Returning From Functions: Quiz II
- Returning From Functions: Buggy Code II
- Returning From Functions: Quiz III
- Returning From Functions: Buggy Code III
- Returning From Functions: Quiz IV
- Returning From Functions: Buggy Code IV
Calculations - Challenges
Strings I
- Quotes Inside Quotes
- Escaping Characters
- String Concatenation II
- String Interpolation
- Accessing Characters
- String Slicing
- String Immutability
- String Length
- String Negative Index
- Exceeding String Bounds
- String Find
- String Replace
- String Split
- String Strip / Trim
- Uppercase and Lowercase
- Top K Brands 1: One Brand
Strings - Challenges
Conditional Statements
Conditional Statements - Challenges
Lists I
Lists - Challenges
Dictionaries
Dictionaries - Challenges
For Loops - Looping Over Lists
While Loops & For Loops
Loops & Conditionals
Loops & Global Variables
Looping Over List Indices
Projects: Everyday Programs
- Shopping Cart 1: Single Item Total
- Shopping Cart 2: Tax and Discount
- Shopping Cart 3: Free Shipping
- Shopping Cart 4: Cart Sum
- Shopping Cart 5: Coupon Codes
- Shopping Cart 6: Group by Category
- Password Strength 1: Length Check
- Password Strength 2: Has a Digit
- Password Strength 3: Character Classes
- Password Strength 4: Count Character Classes
- Password Strength 5: Common Passwords
- Password Strength 6: Score from 0 to 100
- Report Card 1: One Subject Average
- Report Card 2: Weighted Score
- Report Card 3: Letter Grade
- Report Card 4: Multiple Students
- Report Card 5: Grades by Subject
- Report Card 6: Class Statistics
Loops - Challenges
While Loops - Challenges
Loops With Strings, Lists & Dictionaries
Sets
Helper Functions
Nested Loops
Nested Loops Over Grids
Tuples, Sorting & Built-ins
Strings
PART 2
Coding interviews
Big O, then the patterns behind the questions top tech companies ask, from brute force to dynamic programming.
Free Coding Interview Questions
Big O Notation
Brute Force
Sorting
Partial Sums #1
Partial Sums #2
Matrix
Two Pointers
Hash Table
- Hash Map
- Collection of Numbers
- Ransom Note
- Two Sum IV
- Hash Set
- Distinct Values II
- Remove Duplicates From Array III
- Find Duplicates
- Valid Sudoku
- Longest Subarray Without Reapeating II
- Longest Subarray with at most K Distinct Integers
- Longest Consecutive Sequence II
- Group Anagrams II
- Encode and Decode Strings
- Find The Difference II
- Intersection of Two Arrays
- Top K Frequent Elements
- LRU Cache
- Design Underground System
Binary Search
Recursion
Divide And Conquer
Backtracking
Memoization
Linked Lists
- Linked Lists
- Reverse Linked List
- Remove Linked List Elements
- Remove Nth Node From End Of List
- Remove Duplicates From Sorted Linked List
- Linked List Cycle
- Find the Duplicate Number
- Palindrome Linked List
- Intersection Of Two Linked Lists
- Add Two Numbers
- Flatten Multilevel List
- Flatten Multilevel List II
- Copy List Random Pointer
- Copy List Random Pointer II
- Merge Two Sorted Lists
- Reorder List
- Reverse Nodes in k-Group
- Merge K Sorted Lists
- Merge K Sorted Lists II
Sliding Window
Heap
Stack
Binary Trees
- Post Order Tree Traversal
- Zigzag Tree Traversal
- Symmetric Tree
- Lca In Bst
- Binary Tree Diameter
- Binary Tree Maximum Path Sum
- Kth Smallest Element In Bst
- Validate Binary Search Tree
- Count Good Nodes in Binary Tree
- Max Sum Bst
- Max Sum Bst II
- Post Order Tree Traversal II
- Maximum Depth of Binary Tree
- Balanced Binary Tree
- Invert Binary Tree
- Same Tree
- Subtree of Another Tree
- Recover Tree From Preorder
- Construct Binary Tree from Preorder and Inorder Traversal
- Serialize and Deserialize Binary Tree
- Zigzag Tree Traversal II
- Inorder Tree Traversal
- Level Order Traversal
- Binary Tree Right Side View
- Flatten Binary Tree
- Encoded Tree Sums
- Convert Sorted Array to Binary Search Tree
Tries
Dynamic Programming
- Binary Strings Of Given Length
- Permutations Of Given Length
- Valley Permutations
- Binary Strings Without Consecutive Ones
- Binary Strings With K Ones
- Binary Strings With K Ones On Even Positions
- Binary Strings With At Most K Consecutive Ones
- Permutations With K Inversions
- Digit Product Numbers
- Swap Permutations
- Best Time To Buy Stock
- Best Time To Buy Stock II
- Trapping Rain Water
- Unique Paths
- Climbing Stairs
- Min Cost Climbing Stairs
- House Robber
- House Robber II
- Decode Ways
- Maximum Product Subarray
- Best Time to Buy and Sell Stock with Cooldown
- Coin Change
- Coin Change II
- Partition Equal Subset Sum
- Word Break
- Longest Common Subsequence
- Edit Distance
- Distinct Subsequences
- Regular Expression Matching
- Longest Increasing Subsequence
- Longest Palindromic Substring
- Burst Balloons
Greedy
Intervals
Graphs
- Depth First Search (DFS): Find if Path Exists in Graph
- BFS Min Distance to Every Vertex
- Number Of Islands
- Size Of Islands
- Number of Connected Components in an Undirected Graph
- Graph Valid Tree
- Redundant Connection
- 01 Matrix
- Rotting Oranges
- Walls and Gates
- Shortest Path with Alternating Colors
- Course Schedule
- Course Schedule II
- Alien Dictionary
- Reconstruct Itinerary
- Clone Graph
- Pacific Atlantic Water Flow
- Surrounded Regions
- Dijkstra's Algorithm
- Cheapest Flights Within K Stops
- Swim in Rising Water
- Min Cost to Connect All Points
- Word Ladder
- Word Ladder II
- Word Ladder III
- Word Ladder IV
- Jump Game IV
Bit Manipulation
Object-Oriented Design - Interviews
PART 3
Projects & OOP
Your own command-line tools, then object-oriented programming: inheritance, polymorphism and interfaces, with projects to build.
Projects: Command-Line Tools
- cat 1: Print Lines
- cat 2: Number Lines (-n)
- cat 3: Show Special Characters (-A)
- cat 4: Join Several Files
- head 1: First 10 Lines
- head 2: First n Lines
- head 3: When n Is Too Big
- head 4: Negative n
- wc 1: Count Lines
- wc 2: Count Words (-w)
- wc 3: Count Characters (-c)
- wc 4: Choose What to Count
- grep 1: Lines That Match
- grep 2: Ignore Case (-i)
- grep 3: Lines That Don't Match (-v)
- grep 4: Whole Words (-w)
- uniq 1: Drop Repeated Lines
- uniq 2: Count Repeats (-c)
- uniq 3: Only Repeated Lines (-d)
- uniq 4: Only Unique Lines (-u)
- sort 1: Alphabetical Order
- sort 2: Reverse Order (-r)
- sort 3: Numeric Order (-n)
- sort 4: Sort by Column (-k)
- tr 1: Swap One Character
- tr 2: Translate a Set
- tr 3: Delete Characters (-d)
- tr 4: Squeeze Repeats (-s)
Object-Oriented Programming
- Static Members: Count the Dogs
- Access Modifiers
- Secret PIN
- Getters and Setters
- Inheritance
- Animal Sounds
- Method Overriding
- Custom Greeting
- Composition: Has-a
- Calling the Parent Method
- Polymorphism
- Pay Everyone
- Abstract Classes
- Shape Area
- Interfaces
- Printable Things
- Printing Objects
- Comparing Objects
- Errors and Exceptions
- OOP Capstone
Object-Oriented Programming - Challenges
Projects: Object-Oriented
PART 4
Backend
Build a real API yourself, a small online shop: routes, JSON, SQL, logins, payments and tests.
Backend: How The Web Works
Backend: Your First API
- Your First Route
- Send JSON
- More Routes
- One Product by ID
- When It Isn't There
- Filter with a Query String
- Two Filters at Once
- Add a Product
- Check the Input
- Remove a Product
- Update a Product (PUT)
- Change Only the Price (PATCH)
- Methods a Path Allows
- One Way to Send Errors
- JSON for Unknown Paths
- Sort the List
- Search by Name
- Only the First Few
- List the Categories
- Shop Statistics
- Reviews for a Product
- Project: The Shop So Far
Backend: SQL
- Your First Query
- Choose the Columns
- Filter Rows with WHERE
- AND and OR
- IN and BETWEEN
- Match Text with LIKE
- Missing Values: NULL
- Sort with ORDER BY
- LIMIT and OFFSET
- Distinct Values
- Count Rows
- SUM, AVG, MIN, MAX
- Group Rows with GROUP BY
- Filter Groups with HAVING
- Name Columns with AS
- Add Rows with INSERT
- Change Rows with UPDATE
- Remove Rows with DELETE
- Create a Table
- Primary Keys and Constraints
- Foreign Keys
- Join Two Tables
- LEFT JOIN
- Join Three Tables
- Revenue per Product
- A Query Inside a Query
- CASE: Labels from Values
- Indexes
- Transactions
- Project: Monthly Sales Report
Backend: APIs With A Database
- Connect the Shop to a Database
- Rows as Dictionaries
- One Product from the Database
- Search Products Safely
- Filters in SQL
- Add a Product (INSERT)
- Update a Product (UPDATE)
- Delete a Product (DELETE)
- Orders
- What an Order Contains
- Place an Order
- All or Nothing
- Pages of Results
- Too Many Queries
- Sorting Safely
- Change the Table: Migrations
- A Small Query Helper
- Project: Customers
Backend: Users And Security
- Who May Change Things?
- 401 or 403?
- Sign Up
- Never Store Passwords
- Log In
- Tokens
- Who Am I?
- A login_required Decorator
- Customers and Admins
- Sessions with Cookies
- Log Out
- Change the Password
- Too Many Tries: Rate Limits
- CORS
- Secrets Live Outside the Code
- Validate Everything
- Don't Let Clients Set Everything
- Escape What You Echo
- Only Your Own Orders
- Project: Reviews by Logged-in Users
Backend: Payments And Other Services
- Call Another API
- When the Other API Fails
- Don't Wait Forever
- Try Again, a Few Times
- Take a Payment
- Declined Cards
- Webhooks: The Provider Calls You
- Check the Webhook's Signature
- The Same Request Twice
- Send an Email
- Do It Later: A Job Queue
- A Worker
- When a Job Fails
- Upload a Photo
- Serve the Photo
- Check Uploads
- Prices in Another Currency
- Project: Checkout
Backend: Speed
Backend: Tests And Running It
Backend: Shipping It
Backend: Backend With AI
Backend: Your Own API
Backend: Interview Questions
- Rate Limiter: A Sliding Window
- Rate Limiter: A Token Bucket
- Don't Double-Book the Room
- A Leaderboard with Ties
- The Same Webhook, Twice
- Retry with Backoff
- A Circuit Breaker
- Hold Stock for 10 Minutes
- A Bulk Request That Half Fails
- Autocomplete
- A Key-Value Store with Expiry
- A Job Queue with Priorities
- Two Versions of One API
- A Counter That Doesn't Lose Clicks
- Roll Out to 20% of Users
PART 5
AI Engineering
Add AI to the shop: calling a model, prompts, tools, RAG, evals and agents, tested like any other code.
AI Engineering: Calling A Model
- Your First Model Call
- System and User Messages
- A Conversation
- Stop Reasons and max_tokens
- Tokens and Cost
- Streaming Answers
- When the API Says No: 429 and 529
- Timeouts
- Choosing a Model
- Show It a Picture
- Hand It a PDF
- Let It Think
- Keys Live in the Environment
- An AI Endpoint in Flask
- Project: Product Descriptions
AI Engineering: Prompts That Hold Up
AI Engineering: Structured Output
AI Engineering: Tool Use
AI Engineering: MCP
AI Engineering: Retrieval (RAG)
- Why the Model Doesn't Know Your Shop
- Split Documents into Chunks
- Embeddings
- Similarity
- The Top Matches
- Answer from the Passages
- Cite the Source
- Nothing Relevant: Say So
- Chunk Size Trade-offs
- Keywords and Vectors Together
- Filter by Category
- Keep the Index Fresh
- Injection Hidden in Documents
- Project: Policy Q&A with Sources
- Store the Index in a Database
AI Engineering: Evals
AI Engineering: Agents
AI Engineering: Build Your Own Coding Agent
AI Engineering: Context Engineering
AI Engineering: Production
AI Engineering: Capstone
PART 6
SQL & Databases
SQL past the basics: window functions, WITH queries, table design and interview questions. Then NoSQL: MongoDB and Redis.
SQL: Beyond The Basics
SQL: Designing Tables
SQL: Indexes
SQL: Interview Questions
- Second-Highest Price
- Find Duplicate Emails
- Customers Who Never Ordered
- Top Customer of Each Month
- Percent of Total
- Pivot Rows into Columns
- Find the Missing Ids
- Days in a Row
- Customers Who Spend More Than Average
- Each Customer's First Order
- Customers Who Came Back
- Month over Month
- The Products Behind 80% of Revenue
- The Median Price
- Delete Duplicates, Keep One
- Employees Who Earn More Than Their Manager
- Highest Salary in Each Department
- Customers Who Bought Both
- Bought One but Not the Other
- Who Ordered Again Next Month
- A Moving Average
- Three in a Row
- Each Customer's Favorite Product
- Days Until the Second Order
- Cancellation Rate per Month
- Orders by Size
- New Customers per Month
- Walk a Hierarchy: WITH RECURSIVE
NoSQL: MongoDB
NoSQL: Redis
NoSQL: Choosing A Database
PART 7
Security
Attack your own shop, then close each hole: forged tokens, redirects, file paths, CSRF and more.
Security: Common Attacks
Security: Tokens And Sessions
PART 8
Machine Learning
Analyze the shop's data with pandas, then predict who buys again: models, honest testing, and a neural network from scratch.
Machine Learning: Numpy
Machine Learning: Pandas
Machine Learning: Analysis Projects
Machine Learning: Your First Model
Machine Learning: Models
- Predict a Number: Linear Regression
- Read What the Model Learned
- How Wrong, on Average?
- Logistic Regression
- Put Features on One Scale
- Decision Trees
- How Deep Should a Tree Grow?
- Random Forests
- Which Features Matter?
- Nearest Neighbors
- Words into Numbers: One-Hot
- Groups Without a Label: k-means
- How Many Groups?
- Project: Pick the Best Model
Machine Learning: Doing It Right
Machine Learning: A Neural Network From Scratch
Machine Learning: ML Interview Questions
- Accuracy, Precision, Recall from Scratch
- Write train_test_split
- Write a Standard Scaler
- Linear Regression with Gradient Descent
- Logistic Regression from Scratch
- k-Nearest Neighbors from Scratch
- k-means from Scratch
- Build a Confusion Matrix
- Cosine Similarity
- Softmax
- Gini Impurity
- Find the Best Split
- Naive Bayes from Scratch
- AUC Without a Library
- Write k-Fold Cross-Validation
- PCA from Scratch
- Linear Regression in One Line of Algebra
- TF-IDF from Scratch
- Write a One-Hot Encoder
- Choose the Threshold
Machine Learning: More Models
Machine Learning: Text
Machine Learning: Time Series
Machine Learning: Recommenders
Machine Learning: Statistics And A/B Tests
Machine Learning: Serving A Model
Machine Learning: Deep Learning With PyTorch
Machine Learning: Build Your Own LLM
- Text into Numbers
- How Tokenizers Learn: One Merge
- Guess the Next Letter by Counting
- Inputs and Targets
- Embeddings
- The Smallest Model That Learns
- Look Back, Never Ahead
- Self-Attention
- Several Heads
- A Transformer Block
- Assemble the Model
- Train It
- Generate: Temperature
- Project: A Name Generator, and What the Real Ones Add
PART 9
Data Engineering
Build the shop's data warehouse: files and formats, modeling, pipelines you can re-run, data quality, dbt and Spark.
Data Engineering: Files And Formats
Data Engineering: The Warehouse
Data Engineering: Data Modeling
Data Engineering: Pipelines In Python
Data Engineering: Data Quality
Data Engineering: Dbt
Data Engineering: Orchestration
Data Engineering: Streaming Basics
Data Engineering: Table Formats
Data Engineering: Spark
Data Engineering: Interview Questions
- An Idempotent Daily Load
- Slowly Changing Dimension, Type 2, in SQL
- Dedupe, Keeping the Latest
- Sessions from Clicks
- Top N per Group
- An Incremental Aggregate
- A Skewed Join
- Late Data
- Apply a Change Log
- Which Days Are Missing?
- A Conversion Funnel
- 7-Day Active Users
- Process Each Event Once
- Why Does It Read Every File?
- Do Source and Target Agree?
- First and Last Event per User