82040k

Written on June 24, 2019
% Dans le préambule
% -----------------
\newcommand\pythonstyle{\lstset{
language=Python,
basicstyle=\sffamily,
keywordstyle=\textbf,
commentstyle=\color{blue},
showstringspaces=false,
frame=tb, numbers=left }}
% Python environment
\lstnewenvironment{python}[1][]{
\pythonstyle \lstset{#1} }{}
% -----------------

\begin{python}
def fact(n):
  # Fonction factorielle en Python
  x=1
  for i in range(2,n+1):
      x=x*i
  return x
\end{python}