Practice · Python

Practice Iterating Lists

Loop over list elements directly and with enumerate/zip, and accumulate results across a list.

Iterating Listswarming python…

Space Signal Analyzer

Write a function process_space_data that receives a list of integer signal strengths recorded by a space probe. The function must return a tuple with three items:

  1. The total sum of all strengths.
  2. A new list containing only the positive strengths (zero is not positive).
  3. A list of (index, strength) pairs for every element, where the index starts at 0.

Example:

process_space_data([3, -1, 0, 5])
# returns (7, [3, 5], [(0, 3), (1, -1), (2, 0), (3, 5)])
Press Run to see output, or Check to grade against the tests.

Want a whole course built around iterating lists?

Start my path — free

Adaptive practice, streaks, projects with real code review. Free tier gates AI help, never content.