CodeAgeBy Sitezack
Final project: data pipelineFrom raw data to report0 XP
Chapter progress0/6

Lesson 3 of 6

Validate the records

A robust pipeline rejects invalid data instead of propagating it: empty name, negative score…

A validation function returns a boolean — it will serve as a filter in the main loop.

def is_valid(record):
    return len(record["name"]) > 0 and record["score"] >= 0

🎯 Exercise

Write is_valid(record) that returns True only if the name is not empty AND the score is greater than or equal to 0. Print is_valid({"name": "ada", "score": 10}).

PRO lesson

This advanced chapter is part of CodeAge PRO. Unlock it to keep your adventure going.

Discover PRO