← Quiz: Tuples and Sets: all 15 questions
Quiz: Tuples and Sets · Question 4 of 15
What happens here? (code)
What happens here?
t = (1, 2, 3)
t[0] = 10
- A.t becomes (10, 2, 3)
- B.TypeError
- C.t becomes (10, 1, 2, 3)
- D.Nothing happens
Answer & explanation
Correct answer: TypeError
Tuples are immutable, so assigning to an index raises a TypeError.
Can you get the rest right without peeking?
Take the timed Quiz: Tuples and Sets quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →