Let T be a tuple and L be a list. Evaluate the validity of the following…

2026

Let T be a tuple and L be a list. Evaluate the validity of the following Python statement:

L += T

and select the most appropriate option based on Python’s rules for sequence operations and data types.

  1. A.

    Always valid

  2. B.

    Always invalid

  3. C.

    Valid only when list L and tuple T store similar data types

  4. D.

    Results in a Type Error

Attempted by 415 students.

Show answer & explanation

Correct answer: A

The statement L += T is valid in Python because tuples are iterable, and the list's __iadd__ method can extend a list with any iterable. Therefore, L += T correctly appends each element of the tuple to the list without raising an error. The correct answer is A (Always valid).

Explore the full course: Rssb Senior Computer Instructor