@reagentx/

Try Except

Python

No description

fork
loading
Files
  • main.py
main.py
1
2
3
4
5
6
7
8
9
10
arr = [1, 2, 3]

def print_at_index(a: list, n: int) -> None:
    try:
        print(a[n])
    except IndexError:
        print('Nothing there!')

print_at_index(arr, 3)