Python Practice › Tuple Programs › Program 70
Last element with negative indexing
Write a Python program to get the last element of a tuple with negative indexing.
Input
("p", "y", "t", "o", "n")Output
n
Approach
t[-1].
Solution
print(("p", "y", "t", "o", "n")[-1])Output
n
Learn the concept
New to this topic? Read the lesson, then come back.