Computer Science
What does a + b amount to if a is a tuple and b is 5?
Python Tuples
3 Likes
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
Answered By
3 Likes