+ 11
What is the use of assert in python?
2 ответов
+ 2
We are just assuming that a particular statement, like assume 2+2==4 and check whether it is correct or not. If it is true then the flow continues else AssertError occurs.
assert 2==2
print(1)
assert 2==3
print(2)
Output :1
AssertError
Second assert is false so next statement will not be executed.
- 7
yep