求解python,调用函数

编写—个Python的自定义函数,实现计算从1~n个数字的偶数和,并调用该函数。


def s(n):
    return sum(range(0, n + 1, 2))

print(s(4))
'''--result
6

'''