nerdexam
Python_Institute

PCEP-30-02 · Question #364

Assuming that the tuple is a correctly created tuple, the fact that tuples are immutable means that the following instruction: my_tuple[1] = my_tuple[1] + my_tuple[0]

The correct answer is A. is illegal. See the full explanation below for the reasoning.

Question

Assuming that the tuple is a correctly created tuple, the fact that tuples are immutable means that the following instruction: my_tuple[1] = my_tuple[1] + my_tuple[0]

Options

  • Ais illegal
  • Bmay be illegal if the tuple contains strings
  • Ccan be executed if and only if the tuple contains at least two elements
  • Dis fully correct

How the community answered

(42 responses)
  • A
    83% (35)
  • B
    2% (1)
  • C
    10% (4)
  • D
    5% (2)

Community Discussion

No community discussion yet for this question.

Full PCEP-30-02 Practice