# See if you can predict what will happen with this program
# Then Enter the program to see if your prediction was correct
# Write out an explanation of all the steps in the
#   function test() and its communication with the function addInterest()

# addinterest1.py

def addInterest(balance, rate):
    newBalance = balance * (1+rate)
    balance = newBalance

def test():
    amount = 1000
    rate = 0.05
    addInterest(amount, rate)
    print amount

test()
------------------------------------
# See if you can predict what will happen with this program
# Then Enter the program to see if your prediction was correct
# Write out an explanation of all the steps in the
#   function test() and its communication with the function addInterest()

# addinterest2.py

def addInterest(balance, rate):
    newBalance = balance * (1+rate)
    return newBalance

def test():
    amount = 1000
    rate = 0.05
    amount = addInterest(amount, rate)
    print amount

test()
---------------------
# See if you can predict what will happen with this program
# Then Enter the program to see if your prediction was correct
# Write out an explanation of all the steps in the
#   function test() and its communication with the function addInterest()

# addinterest3.py

def addInterest(balances, rate):
    for i in range(len(balances)):
        balances[i] = balances[i] * (1+rate)

def test():
    amounts = [1000, 2200, 800, 360]
    rate = 0.05
    addInterest(amounts, 0.05)
    print amounts

test()


----------------------------------
# Here is  a program that uses the function cube as suggested in Exercise 5 page 194
# See if you can predict what the program will produce if you give the input of 10.
# Write out answers to the following
#  (a) What does the function cube do?
#
#
#
#

#How does the program use the function to print the value of y3 where y is a variable?

#

#

#

#

# Explain why the final output is is not 27 27, even though cube seems to change the value of answer to 27.

#

#

#

def cube(x):
    answer = x * x * x
    return answer

def main():
    aNumber = input( "Please enter a number ")
    result = cube(aNumber)
    print "the value of %0.2f cubed is %0.2f" % (aNumber, result)
    print "the value of %0.2f cubed is %0.2f" % (result, cube(result))
    answer = 4
    result = cube(3)
    print answer, result


main()