From ed7cbc3e6983f496ec257a4e4f456bae55ab9e5a Mon Sep 17 00:00:00 2001 From: helplessThor <66440538+helplessThor@users.noreply.github.com> Date: Mon, 19 Oct 2020 19:39:34 +0530 Subject: [PATCH] Create compoundInterestFunc.py --- mathgenerator/funcs/compoundInterestFunc.py | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 mathgenerator/funcs/compoundInterestFunc.py diff --git a/mathgenerator/funcs/compoundInterestFunc.py b/mathgenerator/funcs/compoundInterestFunc.py new file mode 100644 index 0000000..dec3e54 --- /dev/null +++ b/mathgenerator/funcs/compoundInterestFunc.py @@ -0,0 +1,11 @@ +from .__init__ import * + +def compoundInterestFunc(maxPrinciple = 10000, maxRate = 10, maxTime = 10, maxPeriod = ): + p = random.randint(100, maxPrinciple) + r = random.randint(1, maxRate) + t = random.randint(1, maxTime) + n = random.randint(1, maxPeriod) + A = p * ((1 + (r/(100*n))**(n*t))) + problem = "Compound Interest for a principle amount of " + str(p) + " dollars, " + str(r) + "% rate of interest and for a time period of " + str(t) + " compounded monthly is = " + solution = round(A, 2) + return problem, solution