Python Practice › Tuple Programs › Program 70

Last element with negative indexing

EasyTuple Programs · 70 of 70

Write a Python program to get the last element of a tuple with negative indexing.

Advertisement
Input
("p", "y", "t", "o", "n")
Output
n

Approach

  1. t[-1].

Solution

Python
print(("p", "y", "t", "o", "n")[-1])
Output
n
Advertisement

Learn the concept

New to this topic? Read the lesson, then come back.

More tuple programs

← All 70 Tuple Programs