raise keyword is used to raise an exception and stops the execution of the programs. It is very useful when you want to work with the input validations.
if test_condition: raise Exception(Statement)
n = (int(input("Enter a number:"))) if (n%2==0): print("The given number is even") else: raise Exception("The number is odd")
Enter a number:3
Exception: The number is odd