git push origin masterMerge branch 'mahimadubey-master'

This commit is contained in:
lukew3
2020-10-23 13:58:27 -04:00

View File

@@ -5,12 +5,12 @@ def arithmeticProgressionSumFunc(maxd=100, maxa=100, maxn=100):
d = random.randint(-1 * maxd, maxd) d = random.randint(-1 * maxd, maxd)
a1 = random.randint(-1 * maxa, maxa) a1 = random.randint(-1 * maxa, maxa)
a2 = a1 + d a2 = a1 + d
a3 = a2 + d a3 = a1 + 2*d
n = random.randint(4, maxn) n = random.randint(4, maxn)
apString = str(a1) + ', ' + str(a2) + ', ' + str(a3) + ' ... ' apString = str(a1) + ', ' + str(a2) + ', ' + str(a3) + ' ... '
problem = 'Find the sum of first ' + str( problem = 'Find the sum of first ' + str(n) + ' terms of the AP series: ' + apString
n) + ' terms of the AP series: ' + apString an = a1+(n-1)*d
solution = n * ((2 * a1) + ((n - 1) * d)) / 2 solution = n * (a1+an) / 2
return problem, solution return problem, solution