


Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!



import string def main():
name = raw_input("Enter your full name: ")
main()
def main(): investment = input("Enter the initial investment: ") apr = input("Enter the APR: ") years = input("Enter the term of the investment (years): ")
balance = float(investment) for year in range(years): balance = balance + (balance * apr) print "End of Year %2d: $%7.2" % (year, balance)
print "After %d years, an initial investment of $%0.2f at %0.1f"+ "interest yields $%0.2f." % (years, investment, apr*100, balance) main()
Function Meaning count(s, sub) Count the number of occurrences of sub in s (^1) By program I mean everything that would have to be typed into a .py file in order for Python to successfully run this code. This includes import statements and a call to main() if a function main() is defined. Peter Piper picked a peck of pickled peppers; If Peter Piper picked a peck of pickled peppers, How many pickled peppers did Peter Piper pick?