Skip to content

Commit 2bf019c

Browse files
committed
Complete exercise 1.9
1 parent 628b068 commit 2bf019c

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

Work/mortgage.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,14 @@
88
total_paid = 0.0
99
months = 0
1010

11+
extra_payment_start_month = int(input('Which month should extra payment start in?'))
12+
extra_payment_end_month = int(input('Which month should extra payment end in?'))
13+
extra_payment = int(input('How much extra payment per month can you afford?'))
14+
1115
while principal > 0:
1216
months = months + 1
13-
if months <= 12:
14-
principal = principal * (1+rate/12) - payment - 1000
17+
if months > extra_payment_start_month and months <= extra_payment_end_month:
18+
principal = principal * (1+rate/12) - payment - extra_payment
1519
else:
1620
principal = principal * (1+rate/12) - payment
1721

0 commit comments

Comments
 (0)