\documentclass[12pt]{article}
\usepackage{pythontex}
\usepackage{graphicx}
\printpythontex
\stdoutpythontex
\usepackage[a4paper]{geometry}
\geometry{top=2cm,
bottom=2.5cm,
left=2.5cm,
right=2cm}
\usepackage[utf8]{inputenc}
\usepackage[T2A,T1]{fontenc}
\usepackage[ukrainian]{babel}
\begin{document}
\TeX{}
\begin{pycode}
import numpy as np
import matplotlib.pyplot as plt
def f(t):
return np.exp(-t) * np.cos(2*np.pi*t)
t1 = np.arange(0.0, 5.0, 0.1)
t2 = np.arange(0.0, 5.0, 0.02)
plt.figure(1)
plt.subplot(211)
plt.plot(t1, f(t1), 'bo', t2, f(t2), 'k')
plt.subplot(212)
plt.plot(t2, np.cos(2*np.pi*t2), 'r--')
plt.savefig('myplot.pdf', bbox_inches='tight')
plt.show()
print (r'\includegraphics[width=\linewidth]{myplot.pdf}')
\end{pycode}
\begin{pycode}
def fib(n): # nth Fibonacci value
a, b = 0, 1
for i in range(n):
a, b = b, a + b
return a
\end{pycode}\inputencoding{cp1251}
Did you know that $F_{10} = \py{3+2}$?
\end{document}
%\python-3.4.4.amd64\Scripts\