CBSE Class 11 Computer Science Question 11 of 114

Tuples — Question 11

Back to all questions
11
Question

Question 11

What does a + b amount to if a is a tuple and b is 5?

Answer

If a is tuple and b is 5 then a + b will raise a TypeError because it is not possible to concatenate a tuple with an integer.

For example:
a = (1, 2)
b = 5
c = a + b

Output

TypeError: can only concatenate tuple (not "int") to tuple