~rickylinden/scripts

10c72126d670301f364da3d0639d7c101cac7a2c — rickylinden 14 days ago
```Added interest for option b
```
```1 files changed, 3 insertions(+), 2 deletions(-)

M compoundcalculator.py
```
`M compoundcalculator.py => compoundcalculator.py +3 -2`
```@@ 1,4 1,5 @@
-# Inspired by this: https://www.thecalculatorsite.com/articles/finance/compound-interest-formula.php
+# Compound calculator by R.
+# Formula from: https://www.thecalculatorsite.com/articles/finance/compound-interest-formula.php

import math
from datetime import date

@@ 56,6 57,6 @@ elif answer == "b":
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 + ".")
+	print("\nYou would need to invest " + str(truncate(findMonthly(m, t, r), 2)) + "€/month, then you should have " + str(m) + "€ by the year " + y + ". The 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...")

```