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

निम्नलिखित कोड का परिणाम क्या है ?

What is the output of the following code ?

ms = ('A', 'D', 'H', 'U', 'N', 'I', 'C')
print(ms[1:4])
A)
B)
C)
D)

Explanation:

Sure! Here's a quick breakdown:

  1. Tuple ms:

    ms = ('A', 'D', 'H', 'U', 'N', 'I', 'C')
    

    It contains 7 elements: 'A', 'D', 'H', 'U', 'N', 'I', 'C'.

  2. Slicing ms[1:4]:

    • This gets elements from index 1 to 3 (the 4th element is excluded).
    • Index 1 = 'D'
    • Index 2 = 'H'
    • Index 3 = 'U'

So, ms[1:4] gives ('D', 'H', 'U').

Answer: (A) ('D', 'H', 'U').

Latest Updates