Created
April 25, 2016 14:08
-
-
Save chadgh/f877fbf72a8af8f3a1d412463272a625 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def calc_sale(price, realtor=True, closing=0.03, mortgage=148000): | |
if realtor: | |
realtor = 0.05 | |
else: | |
realtor = 0.00 | |
cost = price * (closing + realtor) + 450 | |
rtn = price - cost - mortgage | |
return rtn | |
def calc_buy(down_payment, percent_down=0.05): | |
return down_payment / percent_down | |
def calc_sale_range(): | |
print("{:12} | {:12} | {:12}".format('Sale price', | |
'Return', | |
'Max purchasing power') | |
) | |
for price in range(160000, 185000, 5000): | |
rtn = calc_sale(price) | |
down = calc_buy(rtn) | |
print("${price:12,.2f} | ${rtn:12,.2f} | ${down:12,.2f}" | |
.format(price=price, rtn=rtn, down=down)) | |
if __name__ == '__main__': | |
calc_sale_range() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment