venture of iit bombay vjti alumni the easiest way to think of an assertion is to liken it to raise-if statement (or to be more accuratea raise-if-not statementan expression is testedand if the result comes up falsean exception is raised assertions are carried out by the assert statementthe newest keyword to pythonintroduced in version programmers often place assertions at the start of function to check for valid inputand after function call to check for valid output the assert statement when it encounters an assert statementpython evaluates the accompanying expressionwhich is hopefully true if the expression is falsepython raises an assertionerror exception the syntax for assert is assert expression[argumentsif the assertion failspython uses argumentexpression as the argument for the assertionerror assertionerror exceptions can be caught and handled like any other exception using the try-except statementbut if not handledthey will terminate the program and produce traceback