S2 Getting Started With Python and Excel
S2 Getting Started With Python and Excel
Nick DeRobertis1
1 University of Florida
June 9, 2021
Table of Contents
1 An Introductory Model
2 Excel Solution
3 Python Solution
Martha is saving for retirement. She earns $60,000 per year and is
able to save 25% of that. If she invests her savings, earning 5% per
year, and she needs $1,500,000 to retire, how soon can she retire?
Real-world Problem
Cash in the
Wages, Savings Investment bank, person
retires
Table of Contents
1 An Introductory Model
2 Excel Solution
3 Python Solution
Table of Contents
1 An Introductory Model
2 Excel Solution
3 Python Solution
If you don’t have Anaconda Navigator, just open a terminal (search cmd
on Windows, terminal on Mac). Then in the terminal, type jupyter
lab and enter. Then continue with the third step.
In Excel, the basic unit is a cell. In Python, the basic unit is an object.
my_number = 6
my_string = 'ABC'
Table of Contents
1 An Introductory Model
2 Excel Solution
3 Python Solution
Now we’ve got basic models to determine how long it will take
Martha to retire.
We’ve got a few assumptions built into the model. One is that
Martha will earn 5% on her investments
Rates of return are volatile, so we want to see how long it would take
her to retire if her return was different
This says, do something, for each value I pass into the loop
Python Iteration
inputs = [5, 10, 15] Excel Iteration
for item in inputs:
new_value = item + 2
print(new_value)
7
12
17
Lecture Resources
1 Slides - Getting Started with Python and Excel
2 Lecture Notes - Getting Started with Python and Excel
3 Simple Retirement Model - Excel
4 Simple Retirement Model - Python