第16819题 单选题
下列Python程序段中自定义函数do(n)的作用是什么

分析给定Python程序段中自定义函数do(n)的作用:

def do(n):   
    s=0   
    f=1   
    for i in range(1,n+1,2):   
        s=s+1/i*f   
        f=-f   
    return s
print(do(10))
A

求1+1/2+1/3+1/4+1/5+1/6+1/7+1/8+1/9+1/10的值

B

求1+1/3+1/5+1/7+1/9的值

C

求1-1/3+1/5-1/7+1/9-1/10的值

D

求1-1/3+1/5-1/7+1/9的值

程序运行统计
暂无判题统计