100% found this document useful (1 vote)
3K views1 page

3.13 LAB: Input and Formatted Output: House Real Estate Summary

This document provides an example program that takes integer inputs for a house's current price and last month's price. It then outputs a summary with the current price, price change since last month, and estimated monthly mortgage payment formatted to two decimal places. The example input is 200000 and 210000, and the output displays the current price, price change of -$10000, and estimated monthly payment of $850.00 with precise spacing and punctuation.

Uploaded by

CHRIS D
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
3K views1 page

3.13 LAB: Input and Formatted Output: House Real Estate Summary

This document provides an example program that takes integer inputs for a house's current price and last month's price. It then outputs a summary with the current price, price change since last month, and estimated monthly mortgage payment formatted to two decimal places. The example input is 200000 and 210000, and the output displays the current price, price change of -$10000, and estimated monthly payment of $850.00 with precise spacing and punctuation.

Uploaded by

CHRIS D
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

3.

13 LAB: Input and formatted output:


House real estate summary
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.
Output each floating-point value with two digits after the decimal point, which
can be achieved as follows:
print('{:.2f}'.format(your_value))
Ex: If the input is:
200000
210000
the output is:
This house is $200000. The change is $-10000 since last
month.
The estimated monthly mortgage is $850.00.
Note: Getting the precise spacing, punctuation, and newlines exactly right is a
key point of this assignment. Such precision is an important part of
programming.

current_price = int(input())

last_months_price = int(input())

print('This house is ${}. The change is ${} since last month.'.format(current_price, current_price -
last_months_price))

print('The estimated monthly mortgage is ${:.2F}.'.format((current_price * 0.051) / 12))

You might also like