18 lines
326 B
Python
18 lines
326 B
Python
numbers = [10, 20, 30, 40, 50]
|
|
print(numbers[-1])
|
|
print(numbers[-2])
|
|
print(numbers[-3])
|
|
|
|
"""
|
|
Zusatzfrage:
|
|
|
|
30, da das das selbe ist, was ich in
|
|
Schritt 4 getan habe. Ein negativer
|
|
Index von -3 gibt das 3. letzte
|
|
Element aus der Liste aus.
|
|
|
|
Zusatzfrage 2:
|
|
|
|
Es wird ein Fehler ausgegeben.
|
|
IndexError: list index out of range
|
|
""" |