Mega Code Archive

 
Categories / Python Tutorial / Statement
 

Check whether a condition is true and raises an AssertionError (optionally with a supplied error message) if it isnt

age = 12 assert age >= 12, 'Children under the age of 12 are not allowed'