The different between raise and assert | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

The different between raise and assert

What's the difference between raise and assert? Aren't they used to raise error?

13th Oct 2020, 4:34 AM
Haposan Delon Benyamin Pasaribu
1 Answer
0
Assert is used to test a condition,. If false it return an AssertionError. Raise is used to throw exception and you can use it throw an AssertionError
13th Oct 2020, 5:15 AM
Kirabo Ibrahim
Kirabo Ibrahim - avatar