发布时间:2019-07-29 18:47:00
python编写e≈1+1/1!+1/2!+....+1/n! 要求最后一项的值小于10^(-6)
q、求代码
n=1
a=1
e=0
f=1
while a>1e-6:
f=f*n
a=1.0/f
e=e+a
n=n+1
print(e)