当我运行这段代码时,它说ab没有定义。问题是什么?
import math
def taylor(ab):
ab = float(input("What is the parameter precision? :"))
print(f"Calling taylor: {(ab)}")
num = 0
x = 1
n = 0
y = 1
while abs(math.pi - num) > ab:
num = num + (4 * (x / y))
x = x * -1
y += 2
n = n + 1
print(f"Calling basel : {(ab)} returns {(num), (n)}")
taylor(ab)
开心每一天1111
慕田峪4524236
相关分类