Write a function that counts the sum of every element in the odd place in a list


Topic: Write a function that counts the sum of every element in the odd place in a list

Solution

from functools import reduce
def count_second(lst):
    return reduce(lambda x, y: x + y, lst[::2])



List all Python Programs