Created
June 18, 2014 15:56
-
-
Save mpwoz/581486b72b7a32a35aa8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
INTEREST_RATE = [5, 7] | |
ANNUAL_SAVINGS = [40, 50, 60] | |
YEARS = [10, 15, 20] | |
def calculate_total(interest, savings, years): | |
interest = 1. + interest / 100. | |
return sum([savings * (interest ** i) for i in range(years)]) | |
for interest in INTEREST_RATE: | |
for savings in ANNUAL_SAVINGS: | |
for years in YEARS: | |
total = calculate_total(interest, savings, years) | |
total = int(total) | |
print "{1}k for {2} years at {0}%: {3}k".format(interest, savings, years, total) | |
print "" | |
print "-"*25 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment