\documentclass[a5paper]{article}
\usepackage[margin=5mm]{geometry}
\usepackage{pynotebook}
\begin{document}
\begin{NotebookIn}{\linewidth}
def fibonacci_aux(n,a,b):
if n == 0 :
return a
elif n == 1 :
return b
else:
return fibonacci_aux(n-1,b,a+b)
def fibonacci_of(n):
return fibonacci_aux(n,0,1)
[fibonacci_of(n) for n in range(10)]
\end{NotebookIn}
\begin{NotebookOut}{\linewidth}
[0, 1, 1, 2, 3, 5, 8, 13, 21, 34]
\end{NotebookOut}
\begin{NotebookConsole}{\linewidth}
[0, 1, 1, 2, 3, 5, 8, 13, 21, 34]
\end{NotebookConsole}
\end{document}