mirror of
https://github.com/DeaDvey/mathgenerator.git
synced 2025-11-28 06:25:23 +01:00
lint fix
This commit is contained in:
5
.vscode/settings.json
vendored
Normal file
5
.vscode/settings.json
vendored
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"python.linting.pylintEnabled": false,
|
||||||
|
"python.linting.flake8Enabled": true,
|
||||||
|
"python.linting.enabled": true
|
||||||
|
}
|
||||||
@@ -6,11 +6,11 @@ def factorial(n):
|
|||||||
if n == 1 or n == 0:
|
if n == 1 or n == 0:
|
||||||
return 1
|
return 1
|
||||||
else:
|
else:
|
||||||
return n * factorial(n-1)
|
return n * factorial(n - 1)
|
||||||
|
|
||||||
|
|
||||||
def newton_symbol(n, k):
|
def newton_symbol(n, k):
|
||||||
return factorial(n) / (factorial(k) * factorial(n-k))
|
return factorial(n) / (factorial(k) * factorial(n - k))
|
||||||
|
|
||||||
|
|
||||||
def binomialDistFunc():
|
def binomialDistFunc():
|
||||||
@@ -31,12 +31,12 @@ def binomialDistFunc():
|
|||||||
|
|
||||||
for i in range(0, rejections + 1):
|
for i in range(0, rejections + 1):
|
||||||
answer += newton_symbol(float(batch), float(i)) * ((rejected_fraction / 100.) ** float(i)) * \
|
answer += newton_symbol(float(batch), float(i)) * ((rejected_fraction / 100.) ** float(i)) * \
|
||||||
((1 - (rejected_fraction/100.)) ** (float(batch)-float(i)))
|
((1 - (rejected_fraction / 100.)) ** (float(batch) - float(i)))
|
||||||
|
|
||||||
answer = round(100 * answer, 2)
|
answer = round(100 * answer, 2)
|
||||||
|
|
||||||
return problem, answer
|
return problem, answer
|
||||||
|
|
||||||
|
|
||||||
binomial_distribution = Generator("Binomial distribution", 107,
|
binomial_distribution = Generator("Binomial distribution", 107,
|
||||||
"P(X<x)=", "c", binomialDistFunc)
|
"P(X<x)=", "c", binomialDistFunc)
|
||||||
|
|||||||
Reference in New Issue
Block a user