// blog

Articles

// Control Flow
Let Python roll the dice

The problem...
Every program you've written so far is predictable. Same input — same output. Every time.
But real programs aren't always like that. Games. Simulations. Sec…

04 May 2026 1 min read files [1] comments [0] 21 views
// Control Flow
A new kind of loop

The problem...
You know for. It loops through a sequence. It knows exactly how many times it will run before it starts.
But sometimes you don't know how many times you'll need t…

04 May 2026 2 min read files [1] comments [0] 21 views
// Control Flow
More conditions, smarter loop

The problem...
Your while loop has one condition. It works. But real situations rarely have just one rule.
Keep going while the user hasn't quit AND the score is still positive.…

04 May 2026 2 min read files [1] comments [0] 21 views
// Control Flow
while True + break — the classic pattern

The problem...
Sometimes you don't have a condition to start with. You just need the loop to run — and stop only when something specific happens inside.
A condition at the…

04 May 2026 2 min read files [1] comments [0] 21 views
// Control Flow
Roll until you win

The problem...
You've used random. You've used while. Separately, they're useful.
Together — they become something different. A loop that runs until luck decides to stop i…

04 May 2026 2 min read files [1] comments [0] 21 views
// Control Flow
while also has a plan B

The problem...
Your while loop ran. The condition eventually became false. But did it finish normally — or did something interrupt it?
You need to know the difference. And…

04 May 2026 1 min read files [1] comments [0] 21 views