Q. Predict the output:


def h_t(NLst):

    from_back = NLst.pop

    from_front = NLst.pop()

    NLst.append(from_front)

    NLst.insert(0, from_back)


NLst1 = [ [21, 12], 31 ]

NLst3 = NLst1.copy()

NLst2 = NLst1

NLst2[-1] = 5

NLst2.insert(1,6)

h_t(NLst1)

print(NLst1[0], NLst1[-1], len(NLst1))

print (NLst2[0], NLst2[-1], len(NLst2))

print (NLst3[0], NLst3[-1], len(NLst3))


Answer =

Output:-

<built-in method pop of list object at 0x01CC23F0> 5 4
<built-in method pop of list object at 0x01CC23F0> 5 4
[21, 12] 31 2
>>>

3 Comments

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Post a Comment

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Previous Post Next Post