question about assertion | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

question about assertion

I learn python at start ,and I don't know how to use assertion!

9th Aug 2018, 9:48 AM
mixiaose
2 Answers
0
Assert instruction raises AssertionError exception depending on some condition. In this example: `assert 2 > 3, "Error!"` you assert that two is greater than three. This assertion fails and exception with "Error!" text is raised. Assertion is commonly used in testing. You won't use it often.
9th Aug 2018, 9:58 AM
wiad
0
Wow, thanks very much,I know what is assert and i konw it is not often to be used
9th Aug 2018, 2:28 PM
mixiaose