# Calculate effective interest rate
# when an annual rate is compounded monthly
import helper

principal = 100.00
print "Principal =",principal
rateString = raw_input("Enter annual interest rate:")
goodInput = helper.isFloat(rateString)

if not goodInput:
    print "Not a valid interest rate."
    
else:
    annualRate = float(rateString)
    
    print "Annual interest rate = ",annualRate

    monthlyRate = annualRate/12.0
    print "Monthly interest rate = ",monthlyRate

    # make a new variable for the balance
    # so we remember the principal even though
    # the balance changes every month
    balance = principal
    month = 0
    while month < 12:
        # This block will be done 12 times
        print "month ",month
        balance = balance+monthlyRate/100.0*balance
        month = month+1 # move on to next month so that
        # the while loop will finish!

    #Block inside while loop is over.
    print "Balace after 12 months is",balance
    eir = balance-principal
    print "interest earned is",eir

raw_input("Press enter to exit.")
    
