In a homework set I\'m working on, I\'ve come across the following question, which I am having trouble answering in a Python-3 function:
\"Write a fun
Here is one way using operator module:
operator
In [21]: from operator import pos, neg In [23]: ops = (pos, neg) In [24]: sum(ops[ind%2](value) for ind, value in enumerate(lst)) Out[24]: -2