[Tutor] Help on a homework assignment

Jasmane Boyd s1519772 at student.mcckc.edu
Tue Sep 15 15:13:10 EDT 2020


Hello,

I have been stuck on this assignment for 2 days and it is due at midnight
on top of another assignment for this class. I understand what the
assignment is asking for however my code is clearly not working. I've
gotten half of it working but the second part of it I can't get it to work.

Can someone assist me please?

This is the assignment ask and my code:

#The following base code is given for you.
from calculate_gains import calculate_gains

def calculate_gains_over_time(amount_inv=0.0, period=12):


# call the base `calculate_gains` function to estimate the gains for
the first period

    # calculate the first period before entering the loop
    calculate_gains(amount_inv)

    # loop through the specified period to calculate the gain of each month
    for n in (list(range(1, period-1))):


# 1 to period-1 because the first period gains is already calculated above
        calculate_gains(amount_inv)

# call the function to update the value based on the period inside the
loop and the updated amount
        new_amount = total_amount  # update the `new_amount` variable

    # return the final ammount
        print(new_amount)
            #return new_amount


print(calculate_gains_over_time(amount_inv=4000000, period=12))



Thank you for your time,
Jasmane Boyd


More information about the Tutor mailing list