Use of assert statement in Python

Syntax: Assert condition [Error Message] Example 1: assert statement without error message Example 2: assert statement with error message Example 3: assert statement with try & except Example 4: assert statement with function Above, square(10) will return 100, whereas square(-10) will raise an AssertionError because we passed -10. Popular Posts

Read More