Computer Science
Find the errors. State reasons.
t = (1, "a", 9.2)
t[0] = 6
Python Tuples
5 Likes
Answer
t[0] = 6
will raise a TypeError as tuples are immutable (i.e., their elements cannot be changed after creation).
Answered By
3 Likes
Related Questions
Predict the output of the following code snippet?
arr = [1, 2, 3, 4, 5, 6] for i in range(1, 6): arr[i - 1] = arr[i] for i in range(0, 6): print(arr[i], end = "")
Predict the output of the following code snippet ?
Numbers = [9, 18, 27, 36] for Num in Numbers : for N in range(1, Num % 8) : print(N, "#", end=" ") print( )
Find the errors. State reasons.
t = [1, "a", 9.2] t[0] = 6
Find the errors. State reasons.
t = [1, "a", 9.2] t[4] = 6