Fill: Raise Exception
Fill in the Blank Medium
Question
Fill in the blank to raise a ValueError manually.
Code
if age < 0:
___ ValueError("Age cannot be negative")
Hint
The keyword that triggers an exception is...
Explanation
raise explicitly triggers an exception. raise ValueError('Age cannot be negative') creates and raises a ValueError. This is how you signal error conditions in your own code.
Related Resources
Related Lessons
- Exceptions
Raising exceptions.
Look up unfamiliar terms
A beginner-friendly glossary explains jargon in plain English — variables, functions, DOM, Promise, and more.
Decode error messages
Plain-English explanations of common errors — what they mean, why they happen, and how to fix them.
Build real projects
Apply what you learned by building guided projects with starter code and solutions.