Feat: Bilan sur les boucles for
This commit is contained in:
parent
5b7a35fb77
commit
084db581d7
BIN
2nd/13_Programmation/4B_boucle_for.pdf
Normal file
BIN
2nd/13_Programmation/4B_boucle_for.pdf
Normal file
Binary file not shown.
54
2nd/13_Programmation/4B_boucle_for.tex
Normal file
54
2nd/13_Programmation/4B_boucle_for.tex
Normal file
@ -0,0 +1,54 @@
|
||||
\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 connus quelque chose, 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}
|
@ -67,24 +67,33 @@ Types de données: int, float et string -> input donne un string qu'il est parfo
|
||||
Opérations suivant les types de données
|
||||
Traduction algo en français en programme en python
|
||||
|
||||
|
||||
Bilan:
|
||||
|
||||
.. image:: ./2B_variables.pdf
|
||||
:height: 200px
|
||||
:alt: Les types de variables
|
||||
|
||||
|
||||
Étape 3: Conditions if
|
||||
----------------------
|
||||
|
||||
`Conditions if <./3E_conditions.ipynb>`_
|
||||
|
||||
Bilan:
|
||||
|
||||
.. image:: ./3B_conditions.pdf
|
||||
:height: 200px
|
||||
:alt: Les conditions
|
||||
|
||||
|
||||
Étape 4: Boucle for
|
||||
-------------------
|
||||
|
||||
Bilan:
|
||||
|
||||
.. image:: ./4B_boucle_for.pdf
|
||||
:height: 200px
|
||||
:alt: Bilan sur les boucles for
|
||||
|
||||
Étape 5: Boucle While
|
||||
---------------------
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user