Assertion
If we want to validate something then we can put assertion.
assert 0 <= price <= product['price']
If assertion condition doesn't satisfy, we'll get assertion error.
Problem with the assertion is that our code can fail in the Production and stop working
* assertion cant be in the tuple
assert(1 == 2, 'This should fail')
This condition is always True so you'll never get an assertion error.
* Correct Statement:
assert 1==2, ('this condition is not true')
Comments
Post a Comment