Several Exceptions
Completed
The list is [10, 20, 30]. Read an index (text). Print the item at that index. Print not a number for a ValueError and out of range for an IndexError.
Input
One line.
Output
One line.
Example
Input
1
Output
20
Editor
Python
Hints
Write one except clause per exception type.
Solution explanation
Except clauses are tried in order; the first matching one runs.
Show solution
items = [10, 20, 30]
try:
print(items[int(input())])
except ValueError:
print("not a number")
except IndexError:
print("out of range")