python为什么这不起作用

时间:2016-12-27 16:18:12

标签: python pycharm

from math import factorial
import math
def get_bernoulli(n):
    b = 0
    sum = 0
    for k in range (0, n-1):
        part = (factorial(n)) / factorial(k) * factorial(n+1 - k)))*b
        sum += part
        b = -(1/n+1)*sum

pycharm抱怨n k和b。它显示未解决的参考。这意味着什么?

1 个答案:

答案 0 :(得分:0)

让我们来计算这一行中的括号:

part = (factorial(n)) / factorial(k) * factorial(n+1 - k)))*b
  • 4x - “(”
  • 6x - “)”