🚀 Hurry! Offer Ends In
00 Days
00 Hours
00 Mins
00 Secs
Enroll Now
X

निम्नलिखित कोड का आउटपुट क्या है?

What is the output of following code ?

A=[[1,2,3],
[4,5,6],
[7,8,9]]
print(A[1][:])
A)
B)
C)
D)

Explanation:

The correct answer is:

(B) [4, 5, 6]

Explanation:

  • A is a 2D list (a list of lists), where A[1] refers to the second list (since indexing starts from 0), which is [4, 5, 6].
  • The [:] slice operator is used to copy the entire list at index 1. So, A[1][:] gives the list [4, 5, 6].

Output:

(B) [4, 5, 6]

Latest Updates