~rickylinden/scripts

0ed1d50087bb796ab68b405e8a6a811fb287b58c — rickylinden 14 days ago 10c7212
Added interest for option b
1 files changed, 5 insertions(+), 2 deletions(-)

M compoundcalculator.py
M compoundcalculator.py => compoundcalculator.py +5 -2
@@ 50,13 50,16 @@ if answer == "a":
	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.")
	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.")
elif answer == "b":
	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 + ". The interest rate by that point should give you ~" + str(truncate(interestMonthly(m, r), 2)) + "€/month." )
	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...")