1. Learn
  2. /
  3. Courses
  4. /
  5. Introduction to Financial Concepts in Python

Exercise

Falling housing prices and underwater mortgages

Unfortunately, you are also well aware that home prices don't always rise.

An underwater mortgage is when the remaining amount you owe on your mortgage is actually higher than the value of the house itself.

In this exercise, you will calculate the worst case scenario where home prices drop steadily at the rate of 0.45% per month. To speed things up, the cumulative drop in home prices has already been forecasted and stored for you in a variable called cumulative_decline_forecast, which is an array of multiplicative discount factors compared to today's price - no need to add 1 to the rate array.

The outstanding principal on the mortgage is available as principal_remaining.

Instructions

100 XP
  • Forecast the home value over time using a simple operation between the cumulative_decline_forecast array and the initial home_value.
  • Calculate where the mortgage is underwater at each time period, storing an array of boolean values when the condition is true or false.
  • Run the existing code to plot the home value vs. principal remaining over time.