The assert statement is useful to ensure that a given condition is True. If it is not true, it raises AssertionError. The syntax is as follows:
assert condition, message
If the condition is False, then the exception by the name AssertionError is raised along with the 'message' written in the assert statement. If 'message' is not given in the assert statement, and the condition is False, then also AssertionError is raised without message.
A Python program using the assert statement and catching AssertionError. #handling AssertionError