Runtime errors in python

I was trying to solve the problem ‘TREE’ in python but got WA for my solution. So I added an assertion to check for value overflows but the submission still returned WA. So to check whether an assertion error is being reported or not. I added an assertion which is always true as
assert 1==2
but it still displayed WA. So I want to know whether assertion errors are reported as WA?

I’m not python programmer, but is it possible to turn on/off assertion in runtime (it works so in Java) or it works by default (as in C/C++) ?

According to this post ( ), there are not special parameters for python, so if it works as it works in Java, assert statements are ignored.

I don’t know if you can turn off assert statements but if it’s not reporting it, maybe the assert statements have been turned off.

It seems, that in python asserts are enabled by default and you can turn it off using -O (source ), but maybe some python programmer has more info…

1 Like

Thanks for looking into it but I solved the problem so don’t need it right now. It was a silly error on my part.