/
๐Ÿ

Assert command in Python

python

When you want to check the condition in debugging use assert and if the condition is true return true otherwise raise AssertionError

python
x = "hello"
#if condition returns True, then nothing happens:
assert x == "hello"
#if condition returns False, AssertionError is raised:
assert x == "goodbye"
Edit this page
logo
Hi Mohsen save your notes