pySohila’s learning labPYTHON / FIELD GUIDE 01

Work with real shapes of data / CORE PATH

Loops & accumulation

Iteration applies a rule repeatedly while preserving an invariant.

3h planning budget · Sohila Khaled Abbas · Reviewed 2026-11-01

A row loop is useful for learning. Later compare it with SQL and pandas operations.

Understand the idea

Iteration applies a rule repeatedly while preserving an invariant. A row loop is useful for learning. Later compare it with SQL and pandas operations.

Work through the practice with a tiny fixture, predict the result before running it, and record one boundary case. Use the exit check as evidence before moving on.

What to learn

A small original example

total = 0
for amount in [None, 0, -2, 10]:
    if amount is not None and amount >= 0:
        total += amount
print(total)

Practice on your own data

Task 08: sum only nonmissing, nonnegative integer amounts.

Practice this lesson in the Python lab →

EXIT CHECK

valid_total([None, 0, -2, 10]) is 10.

Common pitfalls

Prerequisites

Comparisons & branching

Boot.dev chapter 8 · 03:24:46 ↗

Video and playlist companions

Choose one explanation for the concept, then attempt the practice. These are topic mappings, not a claim that every linked lesson covers every outcome.

Boot.dev · Python for Beginners

Loads YouTube on request. Open on YouTube ↗ if the owner restricts embedding.

كورس Python منحة ITI

Loads YouTube on request. Open on YouTube ↗ if the owner restricts embedding.

Python - The Basics - Part 1 | جحر السوعبان

Loads YouTube on request. Open on YouTube ↗ if the owner restricts embedding.

Sources and further reading

Track progress on this topic → · Markdown source ↗