File
MIT6_0001F16_ps1.pdf
- (673.41KB
)
im trying to do the first part of the problem and i wrote it in python, but im getting the wrong outcome.......
annual_salary = float(input("enter your annual salary: " ))
portion_saved = float(input("enter your portion of salary your going to save: "))
total_cost = float(input("enter cost of dream house: "))
r = 0.04
months = 0
i = 0
down_payment = total_cost*0.25
savings = (annual_salary /12) * portion_saved
current_savings = 0.0
#print("annual salary: " +str(annual_salary))
#i=0
while (current_savings <= down_payment):
current_savings = savings + current_savings
months = months + 1
if(months >= 2):
returning = savings * r
current_savings = current_savings + returning
if (current_savings >= down_payment):
print("Number of months: " + str(months))