mirror of
https://github.com/DeaDvey/mathgenerator.git
synced 2025-11-28 14:35:23 +01:00
linter fix
This commit is contained in:
@@ -20,7 +20,7 @@ def binary2sComplementFunc(maxDigits=10):
|
|||||||
answer[j] = '0'
|
answer[j] = '0'
|
||||||
j -= 1
|
j -= 1
|
||||||
|
|
||||||
if j == 0 and carry == True:
|
if j == 0 and carry is True:
|
||||||
answer.insert(0, '1')
|
answer.insert(0, '1')
|
||||||
|
|
||||||
problem = "2's complement of " + question + " ="
|
problem = "2's complement of " + question + " ="
|
||||||
|
|||||||
@@ -5,14 +5,14 @@ def fibonacciSeriesFunc(minNo=1):
|
|||||||
n = random.randint(minNo, 20)
|
n = random.randint(minNo, 20)
|
||||||
|
|
||||||
def createFibList(n):
|
def createFibList(n):
|
||||||
l = []
|
list = []
|
||||||
for i in range(n):
|
for i in range(n):
|
||||||
if i < 2:
|
if i < 2:
|
||||||
l.append(i)
|
list.append(i)
|
||||||
else:
|
else:
|
||||||
val = l[i - 1] + l[i - 2]
|
val = list[i - 1] + list[i - 2]
|
||||||
l.append(val)
|
list.append(val)
|
||||||
return l
|
return list
|
||||||
|
|
||||||
fibList = createFibList(n)
|
fibList = createFibList(n)
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ def nthFibonacciNumberFunc(maxN=100):
|
|||||||
golden_ratio = (1 + math.sqrt(5)) / 2
|
golden_ratio = (1 + math.sqrt(5)) / 2
|
||||||
n = random.randint(1, maxN)
|
n = random.randint(1, maxN)
|
||||||
problem = f"What is the {n}th Fibonacci number?"
|
problem = f"What is the {n}th Fibonacci number?"
|
||||||
ans = round((math.pow(golden_ratio, n) - math.pow(-golden_ratio, -n)) /
|
ans = round((math.pow(golden_ratio, n) - math.pow(-golden_ratio, -n)) / (math.sqrt(5)))
|
||||||
(math.sqrt(5)))
|
|
||||||
solution = f"{ans}"
|
solution = f"{ans}"
|
||||||
return problem, solution
|
return problem, solution
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ def genById(id):
|
|||||||
# Format is:
|
# Format is:
|
||||||
# <title> = Generator("<Title>", <id>, <generalized problem>, <generalized solution>, <function name>)
|
# <title> = Generator("<Title>", <id>, <generalized problem>, <generalized solution>, <function name>)
|
||||||
# Funcs_start - DO NOT REMOVE!
|
# Funcs_start - DO NOT REMOVE!
|
||||||
#addition = Generator("Addition", 0, "a+b=", "c", additionFunc)
|
# addition = Generator("Addition", 0, "a+b=", "c", additionFunc)
|
||||||
subtraction = Generator("Subtraction", 1, "a-b=", "c", subtractionFunc)
|
subtraction = Generator("Subtraction", 1, "a-b=", "c", subtractionFunc)
|
||||||
multiplication = Generator("Multiplication", 2, "a*b=", "c",
|
multiplication = Generator("Multiplication", 2, "a*b=", "c",
|
||||||
multiplicationFunc)
|
multiplicationFunc)
|
||||||
|
|||||||
Reference in New Issue
Block a user