Computer Science, asked by abhishekbramhane4, 1 month ago

list=[4,1,2,3,5,7,8,9,6]

list.pop(1)

print(list)

4,1,2,3 4,1,2,3,5,7,8 [4,1,2,3,5,7,8,9,6] [4,2,3,5,7,8,9,6] 2​

Answers

Answered by Bananaz
0

Answer:

> [4,2,3,5,7,8,9,6]

Explanation:

If list=[4,1,2,3,5,7,8,9,6], and list.pop(1), the second object of the array would be deleted. Since the computer always counts from 0, the index of 4 from the list is 0, so [4,1,2,3,5,7,8,9,6] would have the index of [0,1,2,3,4,5,6,7,8]. If you are popping index 1, the number in the list would be 1, so the ouput would be [4,2,3,5,7,8,9,6].

Similar questions