yapf update

This commit is contained in:
lukew3
2020-10-21 22:49:08 -04:00
parent 7eb2f4bdf7
commit 7a510c1f53
8 changed files with 31 additions and 19 deletions

View File

@@ -4,7 +4,10 @@ import math
def angleBtwVectorsFunc(maxEltAmt=20):
s = 0
v1 = [round(random.uniform(0, 1000), 2) for i in range(random.randint(2, maxEltAmt))]
v1 = [
round(random.uniform(0, 1000), 2)
for i in range(random.randint(2, maxEltAmt))
]
v2 = [round(random.uniform(0, 1000), 2) for i in v1]
for i in range(len(v1)):
s += v1[i] * v2[i]

View File

@@ -14,7 +14,7 @@ def complexQuadraticFunc(prob_type=0, max_range=10):
b = random.randrange(1, max_range)
c = random.randrange(1, max_range)
d = (b**2 - 4*a*c)
d = (b**2 - 4 * a * c)
else:
d = 0
while d >= 0:
@@ -22,7 +22,7 @@ def complexQuadraticFunc(prob_type=0, max_range=10):
b = random.randrange(1, max_range)
c = random.randrange(1, max_range)
d = (b**2 - 4*a*c)
d = (b**2 - 4 * a * c)
eq = ''
@@ -53,8 +53,8 @@ def complexQuadraticFunc(prob_type=0, max_range=10):
return problem, solution
else:
s_root1 = round((-b + (d)**0.5)/(2*a), 3)
s_root2 = round((-b - (d)**0.5)/(2*a), 3)
s_root1 = round((-b + (d)**0.5) / (2 * a), 3)
s_root2 = round((-b - (d)**0.5) / (2 * a), 3)
sqrt_d = (d)**0.5
@@ -69,5 +69,8 @@ def complexQuadraticFunc(prob_type=0, max_range=10):
return problem, solution
complex_quadratic = Generator("complex Quadratic Equation", 100, "Find the roots of given Quadratic Equation ",
"simplified solution : (x1, x2), generalized solution : ((-b + sqrt(d))/2a, (-b - sqrt(d))/2a) or ((-b + sqrt(d)i)/2a, (-b - sqrt(d)i)/2a)", complexQuadraticFunc)
complex_quadratic = Generator(
"complex Quadratic Equation", 100,
"Find the roots of given Quadratic Equation ",
"simplified solution : (x1, x2), generalized solution : ((-b + sqrt(d))/2a, (-b - sqrt(d))/2a) or ((-b + sqrt(d)i)/2a, (-b - sqrt(d)i)/2a)",
complexQuadraticFunc)

View File

@@ -25,7 +25,8 @@ def decimalToRomanNumeralsFunc(maxDecimal=4000):
elif last_value == 4:
solution += (roman_dict[divisor] + roman_dict[divisor * 5])
elif 5 <= last_value <= 8:
solution += (roman_dict[divisor * 5] + (roman_dict[divisor] * (last_value - 5)))
solution += (roman_dict[divisor * 5] + (roman_dict[divisor] *
(last_value - 5)))
elif last_value == 9:
solution += (roman_dict[divisor] + roman_dict[divisor * 10])
x = math.floor(x % divisor)

View File

@@ -5,7 +5,8 @@ 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

View File

@@ -15,4 +15,6 @@ def perimeterOfPolygons(maxSides=12, maxLength=120):
perimeter_of_polygons = Generator(
"Perimeter of Polygons", 96, "The perimeter of a x sided polygon with lengths of y cm is: ", "z", perimeterOfPolygons)
"Perimeter of Polygons", 96,
"The perimeter of a x sided polygon with lengths of y cm is: ", "z",
perimeterOfPolygons)

View File

@@ -12,9 +12,9 @@ def powerOfPowersFunc(maxBase=50, maxPower=10):
power1=power1,
power2=power2,
step=step)
solution = str(base ** step)
solution = str(base**step)
return problem, solution
power_of_powers = Generator("Power of Powers", 97,
"6^4^2 = 6^(4*2) = 6^6", "46656", powerOfPowersFunc)
power_of_powers = Generator("Power of Powers", 97, "6^4^2 = 6^(4*2) = 6^6",
"46656", powerOfPowersFunc)

View File

@@ -12,9 +12,10 @@ def quotientOfPowerSameBaseFunc(maxBase=50, maxPower=10):
power1=power1,
power2=power2,
step=step)
solution = str(base ** step)
solution = str(base**step)
return problem, solution
quotient_of_power_same_base = Generator("Quotient of Powers with Same Base", 98,
"6^4 / 6^2 = 6^(4-2) = 6^2", "36", quotientOfPowerSameBaseFunc)
quotient_of_power_same_base = Generator("Quotient of Powers with Same Base",
98, "6^4 / 6^2 = 6^(4-2) = 6^2", "36",
quotientOfPowerSameBaseFunc)

View File

@@ -12,9 +12,10 @@ def quotientOfPowerSamePowerFunc(maxBase=50, maxPower=10):
base2=base2,
power=power,
step=step)
solution = str(step ** power)
solution = str(step**power)
return problem, solution
quotient_of_power_same_power = Generator("Quotient of Powers with Same Power", 99,
"6^4 / 3^4 = (6/3)^4 = 2^4", "16", quotientOfPowerSamePowerFunc)
quotient_of_power_same_power = Generator("Quotient of Powers with Same Power",
99, "6^4 / 3^4 = (6/3)^4 = 2^4", "16",
quotientOfPowerSamePowerFunc)