निम्नलिखित पायथन कोड का आउटपुट क्या होगा?
What will be the output of the following Python code ?
tuple1=(5,1,7,6,2)
tuple1.pop(2)
print(tuple1)
A)
B)
C)
D)
Explanation:
The issue here is that the pop()
method is not available for tuples in Python. Tuples are immutable, meaning you cannot modify them by removing elements like you can with lists.
Since the pop()
method is used for lists (not tuples), this will result in an Error.
The correct answer is:
(D) Error