Q. What will be the output of the following code segment:


a. myList = [1,2,3,4,5,6,7,8,9,10]

del myList[3:]

print(myList)


b. myList = [1,2,3,4,5,6,7,8,9,10]

del myList[:5]

print(myList)


c. myList = [1,2,3,4,5,6,7,8,9,10]

del myList[::2]

print(myList)


Answer :-

a = [1, 2, 3]

b = [6, 7, 8, 9, 10]

c = [2, 4, 6, 8, 10]


1 Comments

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

  1. myList = [1,2,3,4,5,6,7,8,9,10]

    print(myList[ 7 : -1 ])

    ReplyDelete

Post a Comment

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

Previous Post Next Post