CBSE Class 11 Computer Science Question 75 of 114

Tuples — Question 12

Back to all questions
12
Question

Question 1(l)

Find the output generated by following code fragments :

t2 = (4, 5, 6)  
t3 = (6, 7)  
t4 = t3 + t2  
t5 = t2 + t3		  
print(t4)	  
print(t5)
Answer
Output
(6, 7, 4, 5, 6)
(4, 5, 6, 6, 7)
Explanation

Concatenate operator concatenates the tuples in the same order in which they occur to form new tuple. t2 and t3 are concatenated using + operator to form tuples t4 and t5.