how to check that index of array exist or not in python to avoid ist out of bound error code example Example: how to check if a list raises IndexError but wihing a if statement python if 0 <= x < len(lst)