assert expression in Python Posted on 2020-09-24 Edited on 2021-09-15 In Learning tags: 1. synatx 1234assert [expression]# it is same withif not [expression]: raise AssertionError 2. with parameters 1234assert expression [, arguments]# same withif not expression: raise AssertionError(arguments) conclusion if an assert is not satisfied, throw exception. easy to detect the errors in code.