Lesson 13 — Validation
Check input before you trust it
Validation means checking that data from a user makes sense before you save it. Django forms have built-in validators (for example EmailField), but they are just functions that answer True or False.
A simple email check: it must contain @, and there must be a dot after the @:
"a@b.com".split("@")[1] # 'b.com'
Note: the exercise runs in your browser without Django installed, so it is a small plain-Python simulation of what Django does for you.
Why it matters: bad data saved once causes bugs for months — check it at the door.
Finish valid_email: True only when there is exactly one @ and the part after it contains a dot.
Run your code — when the output matches the task, you will see a green check. Then mark the lesson complete.
A quick 3-question quiz on this lesson — instant feedback.