+ 3
I don't really understand the use of assertions
2 Answers
+ 19
They are mostly used in debugging to help you find errors or unintended behaviour of your code. Whenever the assertion is False, it will intentionally raise an exception and you can spot when it happened, which will enable you to localize the error quickly.
Check out the explanations below:
https://www.sololearn.com/discuss/530322/?ref=app
https://www.sololearn.com/discuss/326765/?ref=app
https://www.sololearn.com/discuss/450019/?ref=app
+ 1
assertion is like if u check the statement then it is used