I don't really understand the use of assertions | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

I don't really understand the use of assertions

18th Feb 2018, 8:49 PM
Joy Sylver
Joy Sylver - avatar
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
18th Feb 2018, 9:44 PM
Kuba Siekierzyński
Kuba Siekierzyński - avatar
+ 1
assertion is like if u check the statement then it is used
6th Apr 2018, 7:54 PM
kam channel by manish pbh
kam channel by manish pbh - avatar