CBSE Class 11 Computer Science Question 86 of 114

Tuples — Question 23

Back to all questions
23
Question

Question 3(g)

Carefully read the given code fragments and figure out the errors that the code may produce.

odd= 1,3,5
print(odd + [2, 4, 6])[4]
Answer
Output
TypeError: can only concatenate tuple (not "list") to tuple 
Explanation

Here [2,4,6] is a list and odd is a tuple so because of different data types, they can not be concatenated with each other.