human
I am working on the file "House Investment Return.ipynb".
The first task is:
Not bad. We're well above the paltry 1.3% current risk free rate in year three. By year four, our return rises above the 10% average annual returns for the S&P 500.
There's obviously a couple caveats. First, all of this analysis is predicated on the house being a principle residence. There are many benefits, especially regarding capital gains, that flow from the government in this case. Investment properties are a whole 'nother ball of wax.
Finally, let's keep in mind that this investment scenario has one big caveat: we disappear into thin air after we sell the house, and never spend money on housing again. We'll return to that assumption later.
Bring on the Bears
Of course, market conditions can change drastically and quickly. What does our investment look like in a super-pessimistic case, where our house loses half its value?
Can you write Python code for it?
assistant
#Here does our investment look like in a super-pessimistic case, where our house loses half its value.

def buy_ohno(r, months):
    return buy(r, months, appreciation=0.5)

for year in xrange(1, 21):
    def dcf(r_i): return buy_ohno(r_i / 12, 12 * year) - rent(r_i / 12, 12 * year)
    print year, irr(dcf)