**Why do it?** To ensure data falls within logical or physical boundaries. Even if data exists and is a number, it might not make sense for your specific context (e.g., a person cannot have an age of -5 or 200).
**How to do it:**
- **Standard Comparison:** Use logical operators (`<`, `>`, `<=`, `>=`). Python allows chaining these for cleaner syntax.
```python
age = 150
if 0 <= age <= 120:
print("Valid age.")
else:
print("Error: Age must be between 0 and 120.")
```
**Set Membership (Discrete Range):** If the input must be one of a few specific options.
```python
status = "archived"
valid_statuses = {"active", "inactive", "pending"}
if status in valid_statuses:
print("Status updated.")
else:
print(f"Invalid status. Choose from: {valid_statuses}")
```