Home >>Python Keywords >Python raise Keyword
Python raise keyword is used to raise an exception/error with a customized message and stop the program's execution.
Here is an example of Python raise Keyword:
z = -1
if z < 0:
raise Exception("no numbers below zero")
y = "hello"
if not type(y) is int:
sraise TypeError("Only integers are allowed")