Python - Assert Statement In Python, the assert statement is used to continue the execute if the given condition evaluates to True. If the assert condition evaluates to False, then it raises the AssertionError exception with the specified error message. Syntax assert condition [, Error Message] The following example demonstrates a simple assert statement. Example: x = 10 assert x > 0 print('x is a positive number.') Output x is a positive number. In the above example, the assert condition, x > 0 evaluates to be True, so it will continue to execute the next statement without any error. 25-01-2022
[email protected] 13