Press shift + enter to run a cell.
You can go back to previous cells, change them and re-run them.
print("Hello World")
X = 112
print(X)
range(10)
IPython notebook allows tab-completion and shows docstrings (by pressing tab [shift-tab in latest versions] after the opening parantheses), or using ?
range?
Cells can be arbitrary long or short, and can define functions that will be available in other cells.
def fib(n):
if n in [0, 1]:
return n
return fib(n - 1) + fib(n - 2)
for x in range(5):
print(fib(x))
For all of your plotting needs!
Enable in-line plotting (can be done in config file)
%matplotlib inline
import matplotlib.pyplot as plt
plt.plot(np.random.uniform(size=10))
plt.bar(np.arange(10), np.random.uniform(size=10))
plt.hist(np.random.normal(size=1000))
x, y = np.random.uniform(size=(2, 10))
plt.scatter(x, y, marker="x")
print(np.eye(5))
plt.matshow(np.eye(5))