The goal of this assignment is to get acquainted with Python using Jupyter Notebooks.
You will be doing your work in a Jupyter notebook for this
assignment. You may choose to work on this assignment on a hosted
environment (e.g. tiger)
or on your own local installation of Jupyter and Python. You should use
Python 3.10 for your work, although previous versions (3.8, 3.9) may
work for this assignment. To use tiger, use the credentials you
received. If you work remotely, make sure to download the .ipynb file to
turn in. If you choose to work locally, Anaconda is the easiest
way to install and manage Python. If you work locally, you may launch
Jupyter Lab either from the Navigator application or via the
command-line as jupyter lab
.
The assignment is due at 11:59pm on Monday, January 30.
You should submit the completed notebook file required for this
assignment on Blackboard. The
filename of the notebook should be a1.ipynb
.
Please make sure to follow instructions to receive full credit. Use a markdown cell to Label each part of the assignment with the number of the section you are completing. You may put the code for each part into one or more cells.
The first cell of your notebook should be a markdown cell with a line for your name and a line for your Z-ID. If you wish to add other information (the assignment name, a description of the assignment), you may do so after these two lines.
Write code that prints “Hello, NIU” but split into two lines like the following
Hello,
NIU
<name>
(5 pts)Write code that assigns your name (a string) to a variable, and then
prints Hi, <name>
where <name>
comes from the variable. Thus, if you change the string assigned to the
variable, the output should change.
An annuity is a financial product where you add or subtract the same amount of money every period (e.g., month or year), and earn a consistent interest rate at the end of each period. In an ordinary annuity, the money is added at the end of each period. A bank account with direct deposit is an example of an ordinary annuity. In an annuity due, the money is added at the beginning of the period. Rent is an example of an annuity due. The future value of an annuity is the amount of money you will have if you start with \(C\) dollars, earn an interest rate of \(i\), and keep it invested for \(n\) periods. The present value of an annuity is how much money you need to invest per period in order to have \(C\) dollars after \(n\) periods at a rate of \(i\). \(C\) is the cash flow per period, \(i\) is the interest rate and \(n\) is the number of payments.
Write code that calculates the following four formulas related to
annuities. First, create a cell that assigns the values (\(C = 2000\), \(i =
.15\), \(n = 10\)) to the
variables c
, i
, and n
. Then,
write four cells (one for each part) to calculate the formulas below.
Assign the output to its corresponding variable
(fv_ordinary
, pv_ordinary
,
fv_due
, and pv_due
) and display the output of
each formula’s calculation. Note that your formulas must use the
variables c
, i
, and n
;
this will allow you to also check other values of those variables
(e.g. \(C = 800\), \(i = .03\), \(n =
4\)) by changing their values and rerunning the formula
cells.
\[ FVordinary(C, i, n) = C \times\ \left[\frac{(1+i)^n - 1)}{i}\right] \]
\[ PVordinary(C, i, n) = C \times\ \left[\frac{1-(1+i)^{-n}}{i}\right] \]
\[ FVdue(C, i, n) = C \times\ \left[\frac{(1+i)^n - 1)}{i}\right] \times (1+i) \]
\[ PVdue(C, i, n) = C \times\ \left[\frac{1-(1+i)^{-n}}{i}\right] \times (1+i) \]