Exception Handling for Lists and Sets
Exception Handling for lists and sets¶ In [1]: l = [1, 2, 3, 4] In [2]: l[4] ————————————————————————— IndexError Traceback (most recent call last) /tmp/ipykernel_99/3011213518.py in <module> —-> 1 l[4] IndexError: list index out of range In [3]: l.pop(4) ————————————————————————— IndexError Traceback (most recent call last) /tmp/ipykernel_99/4109986001.py in <module> —-> 1 l.pop(4) IndexError: pop index out of range …