67.4k views
0 votes
python Sites like Zillow get input about house prices from a database and provide nice summaries for readers. Write a program with two inputs, current price and last month's price (both integers). Then, output a summary listing the price, the change since last month, and the estimated monthly mortgage computed as (current_price * 0.051) / 12.

User Tautvydas
by
3.8k points

1 Answer

5 votes

Answer:

current_price = int(input("Enter current price: "))

last_months_price = int(input("Enter last month's price: "))

print("This house is $%d. The change is a $%d since last month." % (current_price, current_price - last_months_price))

print("The estimated monthly mortgage is $%d." % int(current_price*0.045/12))

Step-by-step explanation:

- Ask the user to enter the values for current_price and last_months_price.

- Print the current price.

- Calculate change from last month (current_price - last_months_price) and print it.

- Calculate the mortgage (using given formula (current_price * 0.051) / 12) and print it.

User Shihab
by
4.3k points