Loops: Applied Scenario
≈ 30 minApplied Scenario
Apply the idea in context while keeping the assumptions, units, safety and affected people visible.
This extension applies that lens specifically to Loops.
A loop repeats work. A for loop walks over a range or a list:
total = 0
for i in range(1, 11):
total = total + i
print(total) # 55range(1, 11) gives 1,2,…,10 (the stop value is excluded). A while loop repeats as long as a condition holds. Combine loops with if to count or filter.
Python Foundations — Applied Scenario: Use a for loop to add up the numbers 1 to 10 into a variable total (it should end at 55).
Runs in your browser. Charts (matplotlib) are not supported — use print-based output.
Python Foundations — Applied Scenario: Write count_evens(nums) that returns how many numbers in the list nums are even. (A number is even when n % 2 == 0.)
Runs in your browser. Charts (matplotlib) are not supported — use print-based output.
Python Foundations — Applied Scenario: How many numbers does range(3) produce?
Name the original topic being extended by this applied scenario lesson.
Which statement is the best evidence-led starting point for Loops: Applied Scenario?

