What does assert do? For example in the function:
If you launch your program with -enableassertions (or -ea for short) then this statement:
Where "enabled or disabled" is controlled with the -ea switch and "An error is reported" means that an AssertionError is thrown.
And finally, a lesser known feature of assert:
You can append : "Error message" like this: