Respuesta :
Answer:
integer currentPrice
integer lastMonthPrice
integer changeLastMonth
float mortagage
//Reading input
currentPrice = Get next input
lastMonthPrice = Get next input
//Calculating price change
changeLastMonth = currentPrice - lastMonthPrice
//Calculating mortagage
mortagage = (currentPrice * 0.045) / 12
//Printing output
Put "This house is $" to output
Put currentPrice to output
Put "\nThe change is $" to output
Put changeLastMonth to output
Put " since last month." to output
Put "\nThe estimated monthly mortgage is $" to output
Put mortagage to output
Answer:
- current_price = int(input("Enter current price: "))
- l_price = int(input("Enter last month price: "))
- for i in range(1, 13):
- print("Current price: $" + str(current_price) + ", Last month price: $" + str(l_price))
- l_price = current_price
- current_price += (current_price * 0.045) / 12
Explanation:
The solution code is written in Python 3.
Firstly, get user input for current price and last month price (Line 1 -2).
Create a for loop to traverse through the number from 1 to 12. In the loop, print the current price and last month price (Line 5). Before proceeding to the next round of loop, set the current_price to l_price and then apply the given formula to recalculate the estimated monthly mortgage and assign it to current_price (Line 6-7).