def nth_elm(n):
    return ((-1)**(n+1))/n
    
def nth_elm_func_2(n):
    return (1/n)
    
def sum_of_pogression(func, n):
    return sum(map(func, range(1, n+1)))

print(sum_of_pogression(nth_elm, 3))
print(sum_of_pogression(nth_elm_func_2, 3))