mirror of
https://github.com/DeaDvey/mathgenerator.git
synced 2025-11-28 14:35:23 +01:00
Merge branch 'y0geshpatil-master'
This commit is contained in:
@@ -1,24 +1,17 @@
|
|||||||
from .__init__ import *
|
from .__init__ import *
|
||||||
|
|
||||||
|
|
||||||
def compoundInterestFunc(maxPrinciple=10000,
|
def compoundInterestFunc(maxPrinciple=10000, maxRate=10, maxTime=10):
|
||||||
maxRate=10,
|
p = random.randint(1000, maxPrinciple)
|
||||||
maxTime=10,
|
|
||||||
maxPeriod=10):
|
|
||||||
p = random.randint(100, maxPrinciple)
|
|
||||||
r = random.randint(1, maxRate)
|
r = random.randint(1, maxRate)
|
||||||
t = random.randint(1, maxTime)
|
n = random.randint(1, maxTime)
|
||||||
n = random.randint(1, maxPeriod)
|
a = p * (1 + r / 100)**n
|
||||||
A = p * ((1 + (r / (100 * n))**(n * t)))
|
problem = "Compound interest for a principle amount of " + \
|
||||||
problem = "Compound Interest for a principle amount of " + str(
|
str(p) + " dollars, " + str(r) + \
|
||||||
p) + " dollars, " + str(
|
"% rate of interest and for a time period of " + str(n) + " year is = "
|
||||||
r) + "% rate of interest and for a time period of " + str(
|
solution = round(a, 2)
|
||||||
t) + " compounded monthly is = "
|
|
||||||
solution = round(A, 2)
|
|
||||||
return problem, solution
|
return problem, solution
|
||||||
|
|
||||||
|
|
||||||
compound_interest = Generator(
|
compound_interest = Generator(
|
||||||
"Compound Interest", 78,
|
"Compound Interest", 78, "Compound interest for a principle amount of a dollars, b% rate of interest and for a time period of c years is = ", "d dollars", compoundInterestFunc)
|
||||||
"Compound interest for a principle amount of p dollars, r% rate of interest and for a time period of t years with n times compounded annually is = ",
|
|
||||||
"A dollars", compoundInterestFunc)
|
|
||||||
|
|||||||
Reference in New Issue
Block a user