मान लीजिए t=(1, 2, 4, 3), तो निम्नलिखित में से कौन सा गलत है?
Suppose t = (1, 2, 4, 3), which of the following is incorrect?
Explanation:
Let's break down the options for the given tuple t = (1, 2, 4, 3)
:
-
(A) print(t[3]): This is correct. Indexing starts from 0, so
t[3]
refers to the fourth element, which is3
. This will print3
. -
(B) t[3] = 45: This is incorrect. Tuples are immutable in Python, meaning their elements cannot be changed after creation. Attempting to modify
t[3]
will result in a TypeError. -
(C) print(max(t)): This is correct. The
max()
function returns the largest element in the tuple. Here, the largest element is4
, so it will print4
. -
(D) print(len(t)): This is correct. The
len()
function returns the number of elements in the tuple. Here, the length oft
is4
, so it will print4
.
Answer:
The incorrect statement is:
(B) t[3] = 45