CBSE Class 11 Computer Science Question 57 of 114

Tuples — Question 9

Back to all questions
9
Question

Question 9

How can you add an extra element to a tuple ?

Answer

We can use the concatenation operator to add an extra element to a tuple as shown below. As tuples are immutable so they cannot be modified in place.

For example:

t=(1,2,3)
t_append = t + (4,)
print(t)
print(t_append)

Output:

(1,2,3)
(1,2,3,4)
Answer