Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Python by (1.6k points)
I have been reading some source code and in several places I have seen the usage of assert.

What does it mean exactly? What is its usage?

1 Answer

0 votes
by (25.1k points)
edited by

assert is similar to throwing an exception if a given condition isn't true. An important difference is that assert statements get ignored if you compile your code with the optimization option.

To know more about this you can have a look at the following video tutorial:-

Related questions

0 votes
1 answer
asked Jul 8, 2019 in Python by Sammy (47.6k points)
+1 vote
1 answer
0 votes
1 answer

Browse Categories

...