29 lines
550 B
TeX
29 lines
550 B
TeX
\documentclass[11pt,a4paper]{../../template/template_cours}
|
||
\usepackage{listings}
|
||
|
||
\usepackage{minted}
|
||
|
||
\title{Mesurer un temps d’exécution en Python}
|
||
\author{Adrian Amaglio}
|
||
\def\thesequence{Python}
|
||
\def\thelevel{NSI}
|
||
|
||
\begin{document}
|
||
\begin{minted}{python}
|
||
import time
|
||
|
||
def fonction_inutile ():
|
||
a = 0
|
||
for i in range (10):
|
||
a = a**i
|
||
return a
|
||
|
||
start_time = time.time()
|
||
fonction_inutile()
|
||
end_time = time.time()
|
||
temps_execution = end_time - start_time
|
||
print("La fonction a mis : ", temps_execution)
|
||
|
||
\end{minted}
|
||
\end{document}
|