Computer Science
Find the errors. State reasons.
t = [1, "a", 9.2]
t[4] = 6
Python List Manipulation
2 Likes
Answer
t[4] = 6
will raise an error as we are trying to change the value at index 4 but it is outside the current range of the list t
. As t
has 3 elements so its indexes are 0, 1, 2 only.
Answered By
1 Like