## ~rickylinden/scripts

da9e1d15e0439d3ed421e499d7ba1bcb5eed3181 — rickylinden 30 days ago
```Made compoundcalculator in its seperate repository
```
```1 files changed, 0 insertions(+), 65 deletions(-)

D compoundcalculator.py
```
`D compoundcalculator.py => compoundcalculator.py +0 -65`
```@@ 1,65 0,0 @@
-# Compound calculator by R.
-# Formula from: https://www.thecalculatorsite.com/articles/finance/compound-interest-formula.php
-
-import math
-from datetime import date
-
-# total sum of the starting amount with interest over time
-def initialCompound(p, r, t):
-	n = 12 # n is compounds per year
-	return p * (1 + r / n) ** (n * t)
-
-# total sum of regular savings with interest over time
-def regularCompound(pmt, r, t):
-	n = 12 # n is compounds per year
-	return pmt * (((1 + r / n) ** (n * t) - 1) / (r / n))
-
-# total sum of regular savings with interest over time
-def findMonthly(m, t, r):
-	n = 12 # n is compounds per year
-	return m / (((1 + r / n) ** (n * t) - 1) / (r / n))
-
-# interest per month at t
-def interestMonthly(value, r):
-	return (value * r) / 12
-
-# to round numbers at two decimals
-def truncate(number, digits) -> float:
-	stepper = 10.0 ** digits
-	return math.trunc(stepper * number) / stepper
-
-def year(t):
-	return str(date.today().year + t)
-
-print("+-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+-+-+")
-print("|c|o|m|p|o|u|n|d| |i|n|t|e|r|e|s|t| |c|a|l|c|u|l|a|t|o|r|")
-print("+-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+-+-+")
-print("(NOTE: Taxes/fees are not taken into consideration.)\n")
-
-print("a) You want to see how much money your monthly investment becomes after certain amount of years.")
-print("b) You know how much money you want and would like to know how long it takes to get it by investing.")
-
-	p=float(input('\nEnter your investment amount when starting out (defaults to 0 if empty): ') or "0")
-	pmt=float(input('Monthly contribution to investment (defaults to 1000€ if empty): ') or "1000")
-	t=int(input('The amount of years you will invest (defaults to 30 years if empty): ') or "30")
-	r = float(input("The average interest rate during these years (defaults to 0.05, meaning 5%, if empty): ") or "0.05")
-	y = year(t)
-
-	value = initialCompound(p, r, t) + regularCompound(pmt, r, t)
-
-	print("\nAfter " + str(t) + " years you should in total have: ~" + str(truncate(value, 2)) + "€.")
-	print("Which means that in the year " + y + " you get, more or less depending on that months interest, " +
-str(truncate(interestMonthly(value, r), 2)) + "€/month in interest alone.")
-	m=float(input('\nEnter the amount of money you want to have (defaults to 1000000€): ') or 1000000)
-	t=int(input('The amount of years you will be investing (defaults to 30 years): ') or 30)
-	r=float(input('The average interest rate during these years (defaults to 0.05, meaning 5%): ') or 0.05)
-	y = year(t)
-
-	print("\nYou would need to invest " + str(truncate(findMonthly(m, t, r), 2)) + "€/month, then you should have " +
-str(m) + "€ by the year " + y + ". \nThe interest rate by that point should give you ~" +
-str(truncate(interestMonthly(m, r), 2)) + "€/month." )
-else:
-	print("You didn't choose a valid option, exiting...")

```