CBSE Class 11 Computer Science
Question 47 of 82
Lists in Python — Question 12
Back to all questions1
3
5
7
9
In the given code, myList is initialized as [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]. The for loop iterates over the range of indices from 0 to len(myList)-1. Inside the loop, the if statement checks if the current index i is even by using the modulus operator i % 2 == 0. If the condition is true (i.e., the index is even), it prints the element at that index in myList. As a result, the code prints all the elements at even indices, specifically: 1, 3, 5, 7, and 9.