If you're seeing this message, it means we're having trouble loading external resources on our website.

If you're behind a web filter, please make sure that the domains *.kastatic.org and *.kasandbox.org are unblocked.

Main content

Trace for loops with range

Problem

Keala is creating a study schedule for her history test at the end of the term. She starts her loop with the for statement below.
for day in range(num_weeks * 7):
The variable num_weeks contains the value 2 when the for loop executes.
How many times does the loop body execute?
  • Your answer should be
  • an integer, like 6
  • a simplified proper fraction, like 3/5
  • a simplified improper fraction, like 7/4
  • a mixed number, like 1 3/4
  • an exact decimal, like 0.75
  • a multiple of pi, like 12 pi or 2/3 pi