Loop Structure for Calculations
Given:
âĸ Start position: x = 0
âĸ Steps needed: n = 10
âĸ Distance per step: d = 500 km
âĸ Loop variable: i (changes each time)
Pattern:
for i in range(n):
position = i à d
print("Step", i, "Position:", position)
đĄ Katherine's Note:
"Loops repeat calculations automatically! Each time through the loop, 'i' increases by 1. We use it to calculate the next position and print the result. This is how we track the spacecraft's journey step by step."