Numeric validation keeps values inside the range a program is prepared to handle.

Range Checks

range_check.py
def status_for_age(age):
    if age < 18:
        return "too_young"
    if age > 120:
        return "too_high"
    return "ok"


age = 
status = status_for_age(age)

print(f"age={age}:{status}")
def status_for_age(age):
    if age < 18:
        return "too_young"
    if age > 120:
        return "too_high"
    return "ok"


age = 
status = status_for_age(age)

print(f"age={age}:{status}")
range check A range check compares a value against lower and upper bounds and returns a clear decision.