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'
|
||||
j -= 1
|
||||
|
||||
if j == 0 and carry == True:
|
||||
if j == 0 and carry is True:
|
||||
answer.insert(0, '1')
|
||||
|
||||
problem = "2's complement of " + question + " ="
|
||||
|
||||
@@ -5,14 +5,14 @@ def fibonacciSeriesFunc(minNo=1):
|
||||
n = random.randint(minNo, 20)
|
||||
|
||||
def createFibList(n):
|
||||
l = []
|
||||
list = []
|
||||
for i in range(n):
|
||||
if i < 2:
|
||||
l.append(i)
|
||||
list.append(i)
|
||||
else:
|
||||
val = l[i - 1] + l[i - 2]
|
||||
l.append(val)
|
||||
return l
|
||||
val = list[i - 1] + list[i - 2]
|
||||
list.append(val)
|
||||
return list
|
||||
|
||||
fibList = createFibList(n)
|
||||
|
||||
|
||||
@@ -5,7 +5,6 @@ def nthFibonacciNumberFunc(maxN=100):
|
||||
golden_ratio = (1 + math.sqrt(5)) / 2
|
||||
n = random.randint(1, maxN)
|
||||
problem = f"What is the {n}th Fibonacci number?"
|
||||
ans = round((math.pow(golden_ratio, n) - math.pow(-golden_ratio, -n)) /
|
||||
(math.sqrt(5)))
|
||||
ans = round((math.pow(golden_ratio, n) - math.pow(-golden_ratio, -n)) / (math.sqrt(5)))
|
||||
solution = f"{ans}"
|
||||
return problem, solution
|
||||
|
||||
@@ -40,7 +40,7 @@ def genById(id):
|
||||
# Format is:
|
||||
# <title> = Generator("<Title>", <id>, <generalized problem>, <generalized solution>, <function name>)
|
||||
# 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)
|
||||
multiplication = Generator("Multiplication", 2, "a*b=", "c",
|
||||
multiplicationFunc)
|
||||
|
||||
Reference in New Issue
Block a user