Expecting an IndexError, but not getting one [duplicate]
The reason it is not giving you an IndexError comes from how and
operations occur in the code. Case 2 will not get to the point of looking for x+2 because it fails on the other operations before.
a = [True, True, True]
if a[0] == False and a[100000] == None:
for example, will never give you an IndexError because it fails on the first if.