arr = ['a', 'b', 'c'] for i in range(4): try: print(arr[i]) except IndexError as e: print(f'{e}: {i} is out of range')