Get startedGet started for free

Taking out a mortgage loan

You're expecting a child soon, and its time to start looking for a home.

You're currently living out of an apartment in New York City, but your blossoming career as a Data Scientist has allowed you to save up a sizable sum and purchase a home in neighboring Hoboken, New Jersey.

You have decided to purchase a beautiful brownstone home in the $800,000 range. While you do have a considerable amount of cash on hand, you don't have enough to purchase the entire home outright, which means you will have to take the remaining balance out as a mortgage loan. From the sound of it, you'll have to put about 20% down up-front to a mortgage loan of that size.

This up-front payment is known as a down payment.

This exercise is part of the course

Introduction to Financial Concepts in Python

View Course

Exercise instructions

  • Set home_value equal to 800000.
  • Set the down_payment_percent equal to 20%.
  • Calculate the value of down_payment.
  • Calculate the value of mortgage_loan.

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

import numpy as np

# Set the value of the home you are looking to buy
home_value = ____

# What percentage are you paying up-front?
down_payment_percent = ____

# Calculate the dollar value of the down payment
down_payment = ____
print("Initial Down Payment: " + str(down_payment))

# Calculate the value of the mortgage loan required after the down payment
mortgage_loan = ____
print("Mortgage Loan: " + str(mortgage_loan))
Edit and Run Code