Ages 12–14 · Growing
Loop invariant
Apply iteration strategies to justify a solution to the loop invariant task.
Understand the idea
A loop’s purpose progress and stopping condition need to agree.
Your challenge
During a sum traversal, total should represent what after k elements?
- Always the final sum before processing
- Only the latest index
- Sum of those k elements
How to explore
- Identify the inputs, goal or constraint in this iteration strategies situation.
- Work through the stated rule or operation without adding assumptions.
- Check your proposed response against every relevant detail in the question.
Open the activity to work with its controls and check your reasoning. Progress stays in this browser.
Keep exploring
DON’T LET THE QUESTION END HEREGive that curiosity
Open the learning space