This is a sample Jupyter Notebook.¶

In [1]:
import matplotlib.pyplot as plt # import a Python graphics package
# We will study matplotlib in my 06matplotlib lecture, coming soon.

Here we find $$\text{Return on Assets} = \frac{\text{Net Income}}{\text{Total Assets}}$$

In [2]:
# some Python code that produces textual output
net_income = 1000
total_assets = 20000
return_on_assets = net_income / total_assets # arithmetic: +, -, *, /, ()
print(return_on_assets)
0.05

Here we make a scatterplot of price vs. year.

In [3]:
# some Python code that produces graphical output
year  = [2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009]
price = [ 1.7,  1.6,  3.6,  3.8,  4.6,  6.3,  5.4,  5.5,  7.6,  8.6]
plt.plot(year, price, marker='o', linestyle='')
plt.title("Price vs. year")
plt.xlabel("Year")
plt.ylabel("Price (dollars)")
plt.xlim(left=1999, right=2010)
plt.ylim(bottom=0, top=10)
Out[3]:
(0.0, 10.0)

From the graph, we can see that price increased through the 2000s.