RosettaCodeData/Task/Arrays/Python/arrays-7.py

7 lines
161 B
Python
Raw Permalink Normal View History

2023-07-01 11:58:00 -04:00
try:
# This will cause an exception, which will then be caught.
print(array[len(array)])
except IndexError as e:
# Print the exception.
print(e)