This file contains hidden or 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
| cash_flow['PV'] = cash_flow['Cash'] / (1 + inflation_rate) ** cash_flow['Year'] | |
| print(round(cash_flow)) |
This file contains hidden or 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
| cash_flow['Cash'] = rent_payment * (1 + rent_growth) ** (cash_flow['Year'] - 1) | |
| print(round(cash_flow)) |
This file contains hidden or 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
| rent_payment = 800 | |
| time = 5 | |
| rent_growth = 0.06 | |
| inflation_rate = 0.03 | |
| cash_flow = pd.DataFrame({'Year': np.arange(1,6), | |
| 'Cash': rent_payment}) | |
| print(cash_flow) |
This file contains hidden or 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
| payment = 200000 | |
| time = 5 | |
| rate = 0.06 | |
| cash_flow = pd.DataFrame({'Period': np.arange(1, 6), | |
| 'PMT': payment}) | |
| print(cash_flow) |
This file contains hidden or 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
| r = 0.03 | |
| cash_flow['PV'] = cash_flow['Cash'] / (1 + r) ** cash_flow['Year'] | |
| npv = cash_flow['PV'].sum() | |
| print('NPV is', + round(npv)) | |
| # NPV is 1596.0 |
This file contains hidden or 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
| # Calculate NPV of uneven cash flows | |
| cash_flow = pd.DataFrame({'Year': [1, 2, 3, 4, 5, 6], | |
| 'Cash': [150, 200, 250, 350, 400, 450]}) | |
| print(cash_flow) |
This file contains hidden or 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
| print('NPV is', + round(npv)) | |
| # NPV is 1083.0 |
This file contains hidden or 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
| import pandas as pd | |
| import numpy as np | |
| import matplotlib.pyplot as plt | |
| r = 0.03 | |
| cash_flow = pd.DataFrame({'Year': [1, 2, 3, 4, 5, 6], | |
| 'Cash': [200, 200, 200, 200, 200, 200]}) | |
| # PV (Present Value) = Cash (at period 1) / (1 + r)^n | |
| cash_flow['PV'] = cash_flow['Cash'] / (1.0 + r) ** cash_flow['Year'] | |
| npv = cash_flow['PV'].sum() |
This file contains hidden or 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
| const price = btcPrices[month]; | |
| if (!price) { | |
| invalidMonthRange(); | |
| return; | |
| } | |
| const lastPrice = btcPrices.lastMonth; | |
| console.log(`Price for month ${month} was ${price}`); | |
| console.log(`While the price for the last month was: ${lastPrice}`); |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
NewerOlder