while — Intermediate Playground
Starts a loop that repeats as long as its condition is true
Python Playground
Output
Click "Run" to execute your codeThe else clause of a while loop runs only if the loop completed normally (without break). This is a clean pattern for search loops.
Challenge
Try modifying the code above to explore different behaviors. Can you extend the example to handle a new use case?