// resources
Resources
All
|
Cheatsheet
Code Example
Exercise
Template
Other
Achievement
|
Basics
Control Flow
Functions
Data Structures
Modules & Packages
Projects
Object-oriented programming
|
↑ oldest first
↓ newest first
// Cheatsheet
pass / continue / break — The Full Picture
pass / continue / break — The Full Picture. Three tools, three jobs. Side by side, with for...else, search pattern, and…
// Code Example
random_module.py
random — randint() and choice(). Set the boundaries, let Python fill in the surprise.
// Code Example
while_loops.py
while — repeats as long as a condition is True. You control what changes. The loop controls when it stops.
// Code Example
while_complex_conditions.py
while with and, or, not — multiple conditions, smarter loops. All conditions matter.
// Code Example
while_true_break.py
while True + break — the infinite loop you control. Run forever, stop on purpose. Input validation is the classic use c…
// Code Example
while_random.py
while + random — the loop that stops when luck decides. Roll until you hit the target, count the attempts, never know h…
// Code Example
while_else.py
while...else — else runs when the loop completes naturally. Skipped when break interrupts. Completed or interrupted — w…
// Exercise
accumulator.py
Accumulator — while True + break. Keep adding numbers until you say stop. Total and count — both ready at the end.
// Exercise
rock_paper_scissors.py
Rock, Paper, Scissors — while counts the rounds, random plays for the computer, continue handles invalid input. A full …
// Other
while_mistakes.py
5 mistakes almost every beginner makes with while. Infinite loops, false conditions, missing break, invalid input, off …
// Cheatsheet
while loops — The Full Picture
while loops — The Full Picture. random, while, complex conditions, while True + break, while + random, while...else, co…
// Achievement
while_complete_medal.stl
You finished the WHILE chapter. Download, print, and keep it. You earned it.
// Code Example
match_case.py
match / case — one value, many cases. Cleaner than long if / elif chains. Wildcard case _, multiple values with |, firs…
// Code Example
match_case_guards.py
match / case with guards — not just values, conditions too. Pattern captures the value, guard adds the condition. Toget…
// Exercise
vending_machine.py
Vending Machine — match identifies the product, if handles the payment. Change calculated, unknown products caught by c…