Write Python script to print the difference of even-indexed elements and odd-indexed elements of a list
Answers
Answered by
1
Answer:
One way is using the range() function, such that it starts at the first odd index, 1 , and has a step value of 2 , so that it returns the odd indices 1, 3, 5, ... . Another way to obtain the odd indices of a list is using list comprehension, in which you can use a condition that will only include the odd indices.
Explanation:
MARK AS BRAINLIST
Similar questions