Question: What does the assert keyword do ? It converts the object after it to a boolean, and if the expression afterwards would normally raise an
What does the assert keyword do
It converts the object after it to a boolean, and if the expression afterwards would normally raise an error, it converts it to False
The text after it will be printed to the screen no matter what, even if an error would otherwise prevent it
If the expression after it evaluates to True, nothing happens, but if it evaluates to False, it raises an AssertionError
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
