python题,求大神赐解
def jiech(index): ''' 计算阶乘 ''' s = 1 for i in range(1,index + 1): s = i * s return s s = 0 for i in range(1,51): s += 1 / jiech(i) print("%.6f" % s)
def fact(n): return 1 if n=0 or n==1 else n*fact(n-1) s=0 for i in range(1,51): s+=1/fact(i) print(round(s,6))