assert is used to check if a condition evaluates to True and raises an exception if otherwise. It is mainly used for debugging a program since a condition that fails might signify a bug in the program.
Solution for How to use assert in Python : You can use assert to check if a condition is True Use the syntax assert condition to check if condition holds. If condition evaluates to False, an exceptions.AssertionError is thrown.