Suppose L is a list and T is a tuple. Evaluate the following Python statement…
2026
Suppose L is a list and T is a tuple. Evaluate the following Python statement and choose the correct observation regarding its execution:
L.extend(T)
- A.
Always valid
- B.
Always invalid
- C.
Always invalid
- D.
Valid only if data types match in both (e.g., all integers or all strings)
Attempted by 526 students.
Show answer & explanation
Correct answer: A
The correct answer is Option A (Always valid).
In Python, the extend() method of a list takes any iterable as an argument. A tuple is an iterable, so L.extend(T) will work without any error. It simply adds each element of the tuple T to the list L.
Example:
L = [1, 2]
T = (3, 4)
After L.extend(T) → L becomes [1, 2, 3, 4]
Thus, the statement is always valid.