New course! Every coder should learn Generative AI!
Try a free lesson+ 1
The raise keyword is used to raise an exception.
You can define what kind of error to raise, and the text to print to the user.
Here's the small example:
x=-1
if x<0
raise Exception("Sorry, no number below zero")
I hope you find it useful. :)