CBSE Class 11 Computer Science Question 65 of 88

Tuples and Dictionary — Question 30

Back to all questions
30
Question

Question 14(g)

Consider the following code and find out the error:

T1 = ('A')
T2 = ('B', 'C', 3)
T3 = T1 + T2
Answer

The code raises an error because T1 is not recognized as a tuple but as a string due to the missing comma. A single-element tuple needs a trailing comma, like T1 = ('A',). Therefore, T1 is a string, and concatenating a string with a tuple using T1 + T2 is not allowed, causing the error.