Medium
Which Errors Were Suppressed?
Use
contextlib.suppress(KeyError, IndexError). A dictionary is {'a': 1, 'b': 2} and a list is [10, 20]. For each query line until END (d key or l index), print the value inside the suppress block; after the block print checked.Input
Lines, then END.
Output
Lines.
Sample 1
Input
d a d z l 1 l 5 END
Output
1 checked checked 20 checked checked
Sample 2
Input
d b END
Output
2 checked
Output appears here