Objective
Create a Python program that shows an element of a fixed list from the position typed by the user, handling positions that do not exist.
Instructions
- Define the list
[10, 20, 30, 40, 50]. - Read an integer position.
- Show the element at that position (negative positions count from the end, as always in Python).
- If the position does not exist, catch
IndexErrorand showIndex out of range.
2
30
Open the editor in full screen: the statement on the left and your code, the output and the tests on the right.
Start exercise