In Python, an assertion is a statement that confirms something about the state of your program. For example, if you write a createUser function and you are sure that the user needs to be older than 18, you assert that the age field is greater than or equal to 18.

Related Articles