Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #=====================================#
- #==============MODULES================#
- #=====================================#
- #=====================================#
- #==============VARIABLES==============#
- #=====================================#
- #=====================================#
- #==============FUNCTIONS==============#
- #=====================================#
- #defines investment algorithm
- def invest(principal, rate, period, years):
- for i in range(years):
- apr = (rate / period)
- principal = (principal * (1 + apr))
- if i == (years - 1):
- print "The value in %s years is %s" % (years, principal)
- #=====================================#
- #=============MAIN PROGRAM============#
- #=====================================#
- def main():
- principal = input("Please enter the initial principal: ")
- rate = input("Please enter the annual interest rate: ")
- period = input("Please enter the number of times the interest rate is compounded: ")
- years = input("Please enter the number of years: ")
- invest(principal, rate, period, years)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement