Python में नीचे दिए गए कोड का परिणाम क्या होगा?
What will be the result of the following Python code?
x = (1, 2, 3)
x[0] = 3
A
(3, 2, 3)
B
(1, 2, 3)
C
TypeError
D
(3, 2, 3, 3)
Explanation
x = (1, 2, 3)
x[0] = 3
यहाँ x एक tuple है, और tuples immutable होते हैं, यानी एक बार बनने के बाद उसके elements को बदला नहीं जा सकता।
➡ जब आप x[0] = 3 करने की कोशिश करेंगे, तो Python एक TypeError देगा।
🔹 Error message (Approximate):
plaintext
TypeError: 'tuple' object does not support item assignment
Correct Answer: C) TypeError