# Compute effective interest rate
# Find total interest paid over a year if
# interest is compounded monthly, and
# express this as a percentage of the
# principle of the debt.

# Use the extra functions in the helper module
import helper

reply = raw_input('Enter original amount of debt: ')
# Keep asking if the string cannot be converted to a float
while not helper.isFloat(reply):
    reply = raw_input('Not a float. Enter a float: ')

# Once we get a string we can convert, convert it and continue on    
principle = float(reply)

reply = raw_input('Enter annual interest rate: ')
while not helper.isFloat(reply):
    reply = raw_input('Not a float. Enter a float: ')

annualRate = float(reply)

print 'principle is',principle
print 'annualRate is',annualRate

monthlyRate = annualRate/12.0

month = 0
balance = principle

while month < 12:
    month = month+1
    # Figure out interest to pay this month
    interest = balance*(monthlyRate/100.0)
    # Increase the balance by this month's interest
    balance = balance+interest

# Print out balance using only two decimal places
# Using a formatting string and the formatting operator '%'
print 'Balance after one year is','%.2f'%balance

# Figure out total interest paid over the whole year
totalInterest = balance - principle
print 'Your total interest is','%.2f'%totalInterest

# What perecent interest did you pay?
eir =  (totalInterest/principle) * 100.0
print "Effective interest rate is",eir




    

