mirror of
https://github.com/DeaDvey/mathgenerator.git
synced 2025-11-28 14:35:23 +01:00
some more lint fixes
This commit is contained in:
@@ -2,9 +2,9 @@ from .__init__ import *
|
|||||||
|
|
||||||
|
|
||||||
def absoluteDifferenceFunc(maxA=100, maxB=100):
|
def absoluteDifferenceFunc(maxA=100, maxB=100):
|
||||||
a = random.randint(-1*maxA, maxA)
|
a = random.randint(-1 * maxA, maxA)
|
||||||
b = random.randint(-1*maxB, maxB)
|
b = random.randint(-1 * maxB, maxB)
|
||||||
absDiff = abs(a-b)
|
absDiff = abs(a - b)
|
||||||
|
|
||||||
problem = "Absolute difference between numbers " + \
|
problem = "Absolute difference between numbers " + \
|
||||||
str(a) + " and " + str(b) + " = "
|
str(a) + " and " + str(b) + " = "
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ def determinantToMatrix22(maxMatrixVal=100):
|
|||||||
c = random.randint(0, maxMatrixVal)
|
c = random.randint(0, maxMatrixVal)
|
||||||
d = random.randint(0, maxMatrixVal)
|
d = random.randint(0, maxMatrixVal)
|
||||||
|
|
||||||
determinant = a*d - b*c
|
determinant = a * d - b * c
|
||||||
problem = f"Det([[{a}, {b}], [{c}, {d}]]) = "
|
problem = f"Det([[{a}, {b}], [{c}, {d}]]) = "
|
||||||
solution = f" {determinant}"
|
solution = f" {determinant}"
|
||||||
return problem, solution
|
return problem, solution
|
||||||
|
|||||||
@@ -4,15 +4,15 @@ from .__init__ import *
|
|||||||
def geomProgrFunc(number_values=6, min_value=2, max_value=12, n_term=7, sum_term=5):
|
def geomProgrFunc(number_values=6, min_value=2, max_value=12, n_term=7, sum_term=5):
|
||||||
r = random.randint(min_value, max_value)
|
r = random.randint(min_value, max_value)
|
||||||
a = random.randint(min_value, max_value)
|
a = random.randint(min_value, max_value)
|
||||||
n_term = random.randint(number_values, number_values+5)
|
n_term = random.randint(number_values, number_values + 5)
|
||||||
sum_term = random.randint(number_values, number_values+5)
|
sum_term = random.randint(number_values, number_values + 5)
|
||||||
GP = []
|
GP = []
|
||||||
for i in range(number_values):
|
for i in range(number_values):
|
||||||
GP.append(a*(r**i))
|
GP.append(a * (r ** i))
|
||||||
problem = "For the given GP "+str(GP)+" ,Find the value of a,common ratio,"+str(
|
problem = "For the given GP " + str(GP) + " ,Find the value of a,common ratio,"+str(
|
||||||
n_term)+"th term value, sum upto "+str(sum_term)+"th term"
|
n_term) + "th term value, sum upto " + str(sum_term) + "th term"
|
||||||
value_nth_term = a*(r**(n_term-1))
|
value_nth_term = a * (r ** (n_term - 1))
|
||||||
sum_till_nth_term = a*((r**sum_term-1)/(r-1))
|
sum_till_nth_term = a * ((r ** sum_term - 1)/(r - 1))
|
||||||
solution = "The value of a is {}, common ratio is {} , {}th term is {} , sum upto {}th term is {}".format(
|
solution = "The value of a is {}, common ratio is {} , {}th term is {} , sum upto {}th term is {}".format(
|
||||||
a, r, n_term, value_nth_term, sum_term, sum_till_nth_term)
|
a, r, n_term, value_nth_term, sum_term, sum_till_nth_term)
|
||||||
return problem, solution
|
return problem, solution
|
||||||
|
|||||||
@@ -46,8 +46,8 @@ def matrixMultiplicationFuncHelper(inp):
|
|||||||
for i in range(m):
|
for i in range(m):
|
||||||
for j in range(n):
|
for j in range(n):
|
||||||
string += f"{inp[i][j]: 6d}"
|
string += f"{inp[i][j]: 6d}"
|
||||||
string += ", "if j < n-1 else ""
|
string += ", "if j < n - 1 else ""
|
||||||
string += "]\n [" if i < m-1 else ""
|
string += "]\n [" if i < m - 1 else ""
|
||||||
string += "]]"
|
string += "]]"
|
||||||
|
|
||||||
return string
|
return string
|
||||||
|
|||||||
@@ -6,8 +6,8 @@ def surdsComparisonFunc(maxValue=100, maxRoot=10):
|
|||||||
degree1, degree2 = tuple(random.sample(range(1, maxRoot), 2))
|
degree1, degree2 = tuple(random.sample(range(1, maxRoot), 2))
|
||||||
|
|
||||||
problem = f"Fill in the blanks {radicand1}^(1/{degree1}) _ {radicand2}^(1/{degree2})"
|
problem = f"Fill in the blanks {radicand1}^(1/{degree1}) _ {radicand2}^(1/{degree2})"
|
||||||
first = math.pow(radicand1, 1/degree1)
|
first = math.pow(radicand1, 1 / degree1)
|
||||||
second = math.pow(radicand2, 1/degree2)
|
second = math.pow(radicand2, 1 / degree2)
|
||||||
|
|
||||||
solution = "="
|
solution = "="
|
||||||
if first > second:
|
if first > second:
|
||||||
|
|||||||
Reference in New Issue
Block a user