Good place to stop if you're short on time — step 3 picks up here.
Without scrolling back — what does the = sign actually do in frame_count = 240?
It puts 240 into the box called frame_count. Right side goes into left side.
In a list of three items, which number gets you the last one — and why not 3?
[2]. Counting starts at zero, so the last of three is two steps from the front. [3] stops the program.
What tells Python which lines belong inside a loop?
The indent — four spaces at the start of the line. Un-indented lines are outside the loop.
What is the difference between print and return?
print shows a value to a human. return hands the value back to the code so the next line can use it.
Record which ideas needed assistance and revisit their lessons. Self-review is not a scored correct answer.
Read the combined example, rebuild the list and loop, repair a parameter bug, then total new clip durations from an independent brief.
If the rebuild is hard, that is information — not failure.
Lesson idea Tap to fold
Answer all four before you look. Each answer is behind its own disclosure.
Day 1. What does = do in frame_count = 240?
Show the answer
It puts 240 into the box labelled frame_count. Right side into left side.
Day 2. In a three-item list, which number in square brackets gets you the last item?
Show the answer
[2]. Counting starts at zero, so the third item is two steps in.
Day 3. What tells Python which lines are inside a loop?
Show the answer
The indent — the four spaces at the start of the line.
Day 4. What is the difference between print and return?
Show the answer
print shows something on screen. return hands a value back so it can be used.
Rebuild, repair and transfer
Your outcome: Combine variables, lists, loops and returning functions, then solve a new collection calculation.
Begin with recall before opening comparisons. Knew it and Looked it up are your own reports, not scored correct answers. The quiz and coding checks record separate evidence.
The guided ingest example uses all four ideas: def creates the helper, clips stores an ordered list, for visits each clip, and the indented call prints a returned string. Trace one call before tracing the whole list.
For a collection total, start a variable at zero. total = total + value computes the next total from the previous one. Keep the update inside the loop; return the total after the loop. On empty input, the update never runs, so the initial zero remains.
The worked accumulator below totals frame counts. Your new transfer task totals seconds at a declared 24 fps instead. Write your own conversion and explain what happens for an empty list. No validation or media decoding is required: the supplied task inputs are nonnegative integer frame counts.
# Rebuild, repair and transfer
def ingest_line(clip):
return "Ingested " + clip
clips = ["harbour.mov", "rooftop.mov"]
for clip in clips:
print(ingest_line(clip))
def total_frames(values):
total = 0
for value in values:
total = total + value
return total
print(total_frames([48, 72]))
Trace: The loop prints Ingested harbour.mov and Ingested rooftop.mov. In total_frames, total changes from 0 to 48 to 120, then 120 returns after both values. Returning inside the loop would stop after the first value.
Keep a private explanation of changed inputs and any help used. A quiz pass or a repaired sample is not an independent transfer result.
Predict, explain, then test
Answer before opening the comparison. These brief answers are self-reviewed, not quiz scores. Task labels describe the brief, not proof that you worked without assistance. Record any examples, hints or tutor help in your own Notes.
Predict
What does total_frames([]) return?
Compare your answer · self-reviewed
0. The loop has no items, so the initial total reaches return unchanged.
Explain
Why does return inside the for block only process the first item?
Compare your answer · self-reviewed
return ends the function call immediately. Put the final return after the loop so every item contributes.
Repair
The repair helper uses count instead of its frames parameter. Why is changing it to 96 not enough?
Compare your answer · self-reviewed
A fixed value cannot handle other calls. Use frames and then test zero and a different positive count.
Independent transfer: total new clip durations
Write total_seconds(frame_counts) with a for loop. Supplied inputs are lists of nonnegative integer frame counts, all at a declared 24 fps. Return the numeric sum of their durations; [] returns zero. Do not mutate the input, print inside the helper or return a fixed sample. Keep both sample calls. Explain your running total and why return belongs after the loop.
Select this final task in the controls. The quiz link selects the unfinished starter without running it. Review loops and indentation and parameters and return if needed.
Read the unfinished starter without running Python
# Return a combined duration from the supplied counts.
def total_seconds(frame_counts):
# Accumulate each duration, then return after the loop.
return None
# Observe changed and empty collections.
print(total_seconds([48, 72]))
print(total_seconds([]))
Sample duration is 5 seconds, then zero for the empty list. Numeric display may include .0. Checks also use a longer list, zero counts, half-seconds and a fractional result; a print replay or returning after the first item fails. Keep a private explanation of the total after each iteration. Knowledge and practical evidence stay separate.
Choose an exercise to load its prompt.
No new idea today, so nothing to pair it with. If the week stuck and you want more, the official tutorial keeps going from exactly where variables, lists, loops, and functions leave off.
- The Python Tutorial — official docs, python.org
Loading exercises…
Noted on your route map, with the step you were on. Nothing is lost by parking it — the next review day will bring this idea back, and the flag tells the course where to slow down.
Section 1 checkpoint
The scored checkpoint loads with JavaScript. The readable recall questions and coding practice above remain available without it. Knowledge scores and practical checks are recorded separately.
The tutor mounts here when JavaScript is available. The lesson above stays readable without it.