CBSE Class 11 Informatics Practices
Question 52 of 80
Lists in Python — Question 15
Back to all questions[2, 4, 6, 8, 10]
In the given code, myList is initialized as [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]. The del myList[::2] statement deletes elements in the list with a step of 2, starting from the beginning of the list. This means, it removes every second element from myList. Specifically, it deletes elements at indices 0, 2, 4, 6, and 8, which correspond to the values 1, 3, 5, 7, and 9. The subsequent print(myList) statement then outputs the modified list, which is [2, 4, 6, 8, 10].