def binomial_coefficient(x,y):
if y == x:
div = 1
elif y == 1:
div = x
elif y > x:
div = 0
else:
a = math.factorial(x)
b = math.factorial(y)
c = math.factorial(x-y)
div = a // (b * c)
return(div)
def problem_9():
for k in range(6):
empty = '\t'
for zed in range(1,6):
X_sub = (10*zed,(1/5)*zed)
n = X_sub[0]
P = X_sub[1]
formula = binomial_coefficient(n,k)*(P**k)*(1-P)**(n-k)
empty = empty + str(formula) + '\t'
print(empty)
problem_9()
我有代码给我正确的数学值,但我需要第一列切换第一行的位置。我希望每次循环的迭代都会发生同样的事情。有人可以帮忙吗?
答案 0 :(得分:0)
只是改变指数:
Central European Standard Time
Israel Standard Time
Pacific Standard Time