Skip to content

Commit 628b068

Browse files
committed
Complete exercise 1.8
1 parent bc5a142 commit 628b068

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

Work/mortgage.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
11
# mortgage.py
22
#
33
# Exercise 1.7
4+
5+
principal = 500000.0
6+
rate = 0.05
7+
payment = 2684.11
8+
total_paid = 0.0
9+
months = 0
10+
11+
while principal > 0:
12+
months = months + 1
13+
if months <= 12:
14+
principal = principal * (1+rate/12) - payment - 1000
15+
else:
16+
principal = principal * (1+rate/12) - payment
17+
18+
total_paid = total_paid + payment
19+
20+
print('Total paid', total_paid, months)

0 commit comments

Comments
 (0)