2024-06-26 00:27:09 发布
网友
import math N=int(input('Non Negative Integer:')) #User Input (iteration/sequence continue until it reaches N) E=0 while N>1: A=N-1 C=A+A/N N=N-1 E=E+A+A/N print(2+1/E)
所以我试图创建一个程序,在其中它接受用户输入(N),并运行e的公式,直到它到达第N次迭代。我不确定问题出在哪里,我希望它看起来像这样
以下是您的答案:
N=int(input('Non negative integer: ')) E=N+1 while N>=1: E=N+N/E N=N-1 print(2+1/E) #> Non negative integer: 2 #> 2.7272727272727275 #> Non negative integer: 3 #> 2.7169811320754715
以下是您的答案:
相关问题 更多 >
编程相关推荐