Bertrand Benjamin
68fd4be1d0
All checks were successful
continuous-integration/drone/push Build is passing
55 lines
1.1 KiB
TeX
55 lines
1.1 KiB
TeX
\documentclass[a4paper,10pt]{article}
|
|
\usepackage{myXsim}
|
|
|
|
\author{Benjamin Bertrand}
|
|
\title{Programmation - Cours}
|
|
\date{Février 2022}
|
|
|
|
\pagestyle{empty}
|
|
|
|
\begin{document}
|
|
|
|
\maketitle
|
|
\setcounter{section}{3}
|
|
|
|
\section{Boucle \lstinline{for}}
|
|
|
|
Quand on veut \textbf{faire} quelque chose un nombre de foi \textbf{connus}, on utilise une boucle \lstinline{for}.
|
|
|
|
\begin{multicols}{2}
|
|
\begin{minipage}{0.8\linewidth}
|
|
\begin{lstlisting}
|
|
for i in range(3):
|
|
print("Coucou")\end{lstlisting}
|
|
Le programme va afficher
|
|
\vspace{2cm}
|
|
\end{minipage}
|
|
|
|
\begin{minipage}{0.8\linewidth}
|
|
\begin{lstlisting}
|
|
somme = 0
|
|
for i in range(4):
|
|
somme = somme + i
|
|
print(somme)\end{lstlisting}
|
|
Le programme va afficher
|
|
\vspace{1cm}
|
|
|
|
Tableau des variables
|
|
|
|
\begin{center}
|
|
\begin{tabular}{c|c}
|
|
i & somme \\
|
|
\hline
|
|
& \\
|
|
& \\
|
|
& \\
|
|
\end{tabular}
|
|
\end{center}
|
|
|
|
\end{minipage}
|
|
\end{multicols}
|
|
|
|
\afaire{Prévoir ce que vont afficher ces deux programmes et compléter le tableau des variables}
|
|
|
|
\end{document}
|