Skip to main content

Practice · 1 of 3

Assert with a Message

CHALLENGE
Difficulty: beginner+25 XP

Write validate_age(age): raise AssertionError('age must be an int') when age is not an int (booleans are NOT ints here), AssertionError('age out of range') when outside 0..150, and return the string ok otherwise.

Back to lesson: Practice: Assertions & Make-the-Tests-Pass