Feat(2nd): Créer bilan et programme tri

This commit is contained in:
Bertrand Benjamin 2018-09-24 11:00:32 +02:00
parent bad7398f89
commit 4ab008da0e
21 changed files with 539 additions and 2 deletions

Binary file not shown.

View File

@ -0,0 +1,97 @@
\documentclass[a4paper,10pt, landscape]{classCours}
\usepackage{listings}
\definecolor{darkWhite}{rgb}{0.94,0.94,0.94}
\lstset{
aboveskip=1mm,
belowskip=-1mm,
backgroundcolor=\color{darkWhite},
basicstyle=\footnotesize,
breakatwhitespace=false,
breaklines=true,
captionpos=b,
commentstyle=\color{red},
deletekeywords={...},
escapeinside={\%*}{*)},
extendedchars=true,
framexleftmargin=16pt,
framextopmargin=3pt,
framexbottommargin=3pt,
frame=tb,
keepspaces=true,
keywordstyle=\color{blue},
language=Python,
literate=
{²}{{\textsuperscript{2}}}1
{}{{\textsuperscript{4}}}1
{}{{\textsuperscript{6}}}1
{}{{\textsuperscript{8}}}1
{}{{\euro{}}}1
{é}{{\'e}}1
{è}{{\`{e}}}1
{ê}{{\^{e}}}1
{ë}{{{e}}}1
{É}{{\'{E}}}1
{Ê}{{\^{E}}}1
{û}{{\^{u}}}1
{ù}{{\`{u}}}1
{â}{{\^{a}}}1
{à}{{\`{a}}}1
{á}{{\'{a}}}1
{ã}{{\~{a}}}1
{Á}{{\'{A}}}1
{Â}{{\^{A}}}1
{Ã}{{\~{A}}}1
{ç}{{\c{c}}}1
{Ç}{{\c{C}}}1
{õ}{{\~{o}}}1
{ó}{{\'{o}}}1
{ô}{{\^{o}}}1
{Õ}{{\~{O}}}1
{Ó}{{\'{O}}}1
{Ô}{{\^{O}}}1
{î}{{\^{i}}}1
{Î}{{\^{I}}}1
{í}{{\'{i}}}1
{Í}{{\~{Í}}}1,
morekeywords={*,...},
numbers=left,
numbersep=10pt,
numberstyle=\tiny\color{black},
rulecolor=\color{black},
showspaces=false,
showstringspaces=false,
showtabs=false,
stepnumber=1,
stringstyle=\color{gray},
tabsize=4,
title=\lstname,
}
\pagestyle{empty}
\geometry{left=10mm,right=10mm, top=7mm, bottom=7mm}
\author{}
\title{}
\date{}
\begin{document}
\begin{minipage}{0.4\textwidth}
\lstinputlisting[language=Python]{tri_bulles.py}
\end{minipage}
\hfill
\begin{minipage}{0.55\textwidth}
\includegraphics[height=250pt, width=430pt, keepaspectratio]{./fig/2nd2_bulles}
\end{minipage}
\begin{minipage}{0.4\textwidth}
\lstinputlisting[language=Python]{tri_min.py}
\end{minipage}
\hfill
\begin{minipage}{0.55\textwidth}
\includegraphics[height=280pt, width=430pt, keepaspectratio]{./fig/2nd2_min}
\end{minipage}
\end{document}

Binary file not shown.

View File

@ -0,0 +1,97 @@
\documentclass[a4paper,10pt, landscape]{classCours}
\usepackage{listings}
\definecolor{darkWhite}{rgb}{0.94,0.94,0.94}
\lstset{
aboveskip=1mm,
belowskip=-1mm,
backgroundcolor=\color{darkWhite},
basicstyle=\footnotesize,
breakatwhitespace=false,
breaklines=true,
captionpos=b,
commentstyle=\color{red},
deletekeywords={...},
escapeinside={\%*}{*)},
extendedchars=true,
framexleftmargin=16pt,
framextopmargin=3pt,
framexbottommargin=3pt,
frame=tb,
keepspaces=true,
keywordstyle=\color{blue},
language=Python,
literate=
{²}{{\textsuperscript{2}}}1
{}{{\textsuperscript{4}}}1
{}{{\textsuperscript{6}}}1
{}{{\textsuperscript{8}}}1
{}{{\euro{}}}1
{é}{{\'e}}1
{è}{{\`{e}}}1
{ê}{{\^{e}}}1
{ë}{{{e}}}1
{É}{{\'{E}}}1
{Ê}{{\^{E}}}1
{û}{{\^{u}}}1
{ù}{{\`{u}}}1
{â}{{\^{a}}}1
{à}{{\`{a}}}1
{á}{{\'{a}}}1
{ã}{{\~{a}}}1
{Á}{{\'{A}}}1
{Â}{{\^{A}}}1
{Ã}{{\~{A}}}1
{ç}{{\c{c}}}1
{Ç}{{\c{C}}}1
{õ}{{\~{o}}}1
{ó}{{\'{o}}}1
{ô}{{\^{o}}}1
{Õ}{{\~{O}}}1
{Ó}{{\'{O}}}1
{Ô}{{\^{O}}}1
{î}{{\^{i}}}1
{Î}{{\^{I}}}1
{í}{{\'{i}}}1
{Í}{{\~{Í}}}1,
morekeywords={*,...},
numbers=left,
numbersep=10pt,
numberstyle=\tiny\color{black},
rulecolor=\color{black},
showspaces=false,
showstringspaces=false,
showtabs=false,
stepnumber=1,
stringstyle=\color{gray},
tabsize=4,
title=\lstname,
}
\pagestyle{empty}
\geometry{left=10mm,right=10mm, top=7mm, bottom=7mm}
\author{}
\title{}
\date{}
\begin{document}
\begin{minipage}{0.4\textwidth}
\lstinputlisting[language=Python]{tri_bulles.py}
\end{minipage}
\hfill
\begin{minipage}{0.55\textwidth}
\includegraphics[height=250pt, width=430pt, keepaspectratio]{./fig/2nd3_bulles}
\end{minipage}
\begin{minipage}{0.4\textwidth}
\lstinputlisting[language=Python]{tri_min.py}
\end{minipage}
\hfill
\begin{minipage}{0.55\textwidth}
\includegraphics[height=280pt, width=430pt, keepaspectratio]{./fig/2nd3_min}
\end{minipage}
\end{document}

Binary file not shown.

View File

@ -0,0 +1,97 @@
\documentclass[a4paper,10pt, landscape]{classCours}
\usepackage{listings}
\definecolor{darkWhite}{rgb}{0.94,0.94,0.94}
\lstset{
aboveskip=1mm,
belowskip=-1mm,
backgroundcolor=\color{darkWhite},
basicstyle=\footnotesize,
breakatwhitespace=false,
breaklines=true,
captionpos=b,
commentstyle=\color{red},
deletekeywords={...},
escapeinside={\%*}{*)},
extendedchars=true,
framexleftmargin=16pt,
framextopmargin=3pt,
framexbottommargin=3pt,
frame=tb,
keepspaces=true,
keywordstyle=\color{blue},
language=Python,
literate=
{²}{{\textsuperscript{2}}}1
{}{{\textsuperscript{4}}}1
{}{{\textsuperscript{6}}}1
{}{{\textsuperscript{8}}}1
{}{{\euro{}}}1
{é}{{\'e}}1
{è}{{\`{e}}}1
{ê}{{\^{e}}}1
{ë}{{{e}}}1
{É}{{\'{E}}}1
{Ê}{{\^{E}}}1
{û}{{\^{u}}}1
{ù}{{\`{u}}}1
{â}{{\^{a}}}1
{à}{{\`{a}}}1
{á}{{\'{a}}}1
{ã}{{\~{a}}}1
{Á}{{\'{A}}}1
{Â}{{\^{A}}}1
{Ã}{{\~{A}}}1
{ç}{{\c{c}}}1
{Ç}{{\c{C}}}1
{õ}{{\~{o}}}1
{ó}{{\'{o}}}1
{ô}{{\^{o}}}1
{Õ}{{\~{O}}}1
{Ó}{{\'{O}}}1
{Ô}{{\^{O}}}1
{î}{{\^{i}}}1
{Î}{{\^{I}}}1
{í}{{\'{i}}}1
{Í}{{\~{Í}}}1,
morekeywords={*,...},
numbers=left,
numbersep=10pt,
numberstyle=\tiny\color{black},
rulecolor=\color{black},
showspaces=false,
showstringspaces=false,
showtabs=false,
stepnumber=1,
stringstyle=\color{gray},
tabsize=4,
title=\lstname,
}
\pagestyle{empty}
\geometry{left=10mm,right=10mm, top=7mm, bottom=7mm}
\author{}
\title{}
\date{}
\begin{document}
\begin{minipage}{0.4\textwidth}
\lstinputlisting[language=Python]{tri_bulles.py}
\end{minipage}
\hfill
\begin{minipage}{0.55\textwidth}
\includegraphics[height=250pt, width=430pt, keepaspectratio]{./fig/2nd4_bulles}
\end{minipage}
\begin{minipage}{0.4\textwidth}
\lstinputlisting[language=Python]{tri_min.py}
\end{minipage}
\hfill
\begin{minipage}{0.55\textwidth}
\includegraphics[height=280pt, width=430pt, keepaspectratio]{./fig/2nd4_min}
\end{minipage}
\end{document}

Binary file not shown.

View File

@ -0,0 +1,97 @@
\documentclass[a4paper,10pt, landscape]{classCours}
\usepackage{listings}
\definecolor{darkWhite}{rgb}{0.94,0.94,0.94}
\lstset{
aboveskip=1mm,
belowskip=-1mm,
backgroundcolor=\color{darkWhite},
basicstyle=\footnotesize,
breakatwhitespace=false,
breaklines=true,
captionpos=b,
commentstyle=\color{red},
deletekeywords={...},
escapeinside={\%*}{*)},
extendedchars=true,
framexleftmargin=16pt,
framextopmargin=3pt,
framexbottommargin=3pt,
frame=tb,
keepspaces=true,
keywordstyle=\color{blue},
language=Python,
literate=
{²}{{\textsuperscript{2}}}1
{}{{\textsuperscript{4}}}1
{}{{\textsuperscript{6}}}1
{}{{\textsuperscript{8}}}1
{}{{\euro{}}}1
{é}{{\'e}}1
{è}{{\`{e}}}1
{ê}{{\^{e}}}1
{ë}{{{e}}}1
{É}{{\'{E}}}1
{Ê}{{\^{E}}}1
{û}{{\^{u}}}1
{ù}{{\`{u}}}1
{â}{{\^{a}}}1
{à}{{\`{a}}}1
{á}{{\'{a}}}1
{ã}{{\~{a}}}1
{Á}{{\'{A}}}1
{Â}{{\^{A}}}1
{Ã}{{\~{A}}}1
{ç}{{\c{c}}}1
{Ç}{{\c{C}}}1
{õ}{{\~{o}}}1
{ó}{{\'{o}}}1
{ô}{{\^{o}}}1
{Õ}{{\~{O}}}1
{Ó}{{\'{O}}}1
{Ô}{{\^{O}}}1
{î}{{\^{i}}}1
{Î}{{\^{I}}}1
{í}{{\'{i}}}1
{Í}{{\~{Í}}}1,
morekeywords={*,...},
numbers=left,
numbersep=10pt,
numberstyle=\tiny\color{black},
rulecolor=\color{black},
showspaces=false,
showstringspaces=false,
showtabs=false,
stepnumber=1,
stringstyle=\color{gray},
tabsize=4,
title=\lstname,
}
\pagestyle{empty}
\geometry{left=10mm,right=10mm, top=7mm, bottom=7mm}
\author{}
\title{}
\date{}
\begin{document}
\begin{minipage}{0.4\textwidth}
\lstinputlisting[language=Python]{tri_bulles.py}
\end{minipage}
\hfill
\begin{minipage}{0.55\textwidth}
\includegraphics[height=250pt, width=430pt, keepaspectratio]{./fig/2nd6_bulles}
\end{minipage}
\begin{minipage}{0.4\textwidth}
\lstinputlisting[language=Python]{tri_min.py}
\end{minipage}
\hfill
\begin{minipage}{0.55\textwidth}
\includegraphics[height=280pt, width=430pt, keepaspectratio]{./fig/2nd6_min}
\end{minipage}
\end{document}

Binary file not shown.

View File

@ -0,0 +1,95 @@
\documentclass[a4paper,10pt, landscape]{classCours}
\usepackage{listings}
\definecolor{darkWhite}{rgb}{0.94,0.94,0.94}
\lstset{
aboveskip=1mm,
belowskip=-1mm,
backgroundcolor=\color{darkWhite},
basicstyle=\footnotesize,
breakatwhitespace=false,
breaklines=true,
captionpos=b,
commentstyle=\color{red},
deletekeywords={...},
escapeinside={\%*}{*)},
extendedchars=true,
framexleftmargin=16pt,
framextopmargin=3pt,
framexbottommargin=3pt,
frame=tb,
keepspaces=true,
keywordstyle=\color{blue},
language=Python,
literate=
{²}{{\textsuperscript{2}}}1
{}{{\textsuperscript{4}}}1
{}{{\textsuperscript{6}}}1
{}{{\textsuperscript{8}}}1
{}{{\euro{}}}1
{é}{{\'e}}1
{è}{{\`{e}}}1
{ê}{{\^{e}}}1
{ë}{{{e}}}1
{É}{{\'{E}}}1
{Ê}{{\^{E}}}1
{û}{{\^{u}}}1
{ù}{{\`{u}}}1
{â}{{\^{a}}}1
{à}{{\`{a}}}1
{á}{{\'{a}}}1
{ã}{{\~{a}}}1
{Á}{{\'{A}}}1
{Â}{{\^{A}}}1
{Ã}{{\~{A}}}1
{ç}{{\c{c}}}1
{Ç}{{\c{C}}}1
{õ}{{\~{o}}}1
{ó}{{\'{o}}}1
{ô}{{\^{o}}}1
{Õ}{{\~{O}}}1
{Ó}{{\'{O}}}1
{Ô}{{\^{O}}}1
{î}{{\^{i}}}1
{Î}{{\^{I}}}1
{í}{{\'{i}}}1
{Í}{{\~{Í}}}1,
morekeywords={*,...},
numbers=left,
numbersep=10pt,
numberstyle=\tiny\color{black},
rulecolor=\color{black},
showspaces=false,
showstringspaces=false,
showtabs=false,
stepnumber=1,
stringstyle=\color{gray},
tabsize=4,
title=\lstname,
}
\pagestyle{empty}
\geometry{left=10mm,right=10mm, top=7mm, bottom=7mm}
\author{}
\title{}
\date{}
\begin{document}
\begin{minipage}{0.5\textwidth}
\lstinputlisting[language=Python]{tri_bulles.py}
\end{minipage}
\begin{minipage}{0.5\textwidth}
\includegraphics[height=250pt]{./fig/2nd2_bulles}
\end{minipage}
\begin{minipage}{0.5\textwidth}
\lstinputlisting[language=Python]{tri_min.py}
\end{minipage}
\begin{minipage}{0.5\textwidth}
\includegraphics[height=280pt]{./fig/2nd2_min}
\end{minipage}
\end{document}

Binary file not shown.

After

Width:  |  Height:  |  Size: 111 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 131 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 74 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 98 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 164 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 99 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 111 KiB

View File

@ -111,9 +111,9 @@ Productions d'élèves
+---------+---+---+---+---+---+
| Min/max | | 2 | 2 | 2 | 4 |
+---------+---+---+---+---+---+
| Bulles | | 0 | 0 | 0 | 0 |
| Bulles | | 1 | 2 | 2 | 1 |
+---------+---+---+---+---+---+
| Monté/descente -> plus bouger | | 1 | 2 | 2 | 1 |
| Bulles amélioré | | 0 | 0 | 0 | 0 |
+---------+---+---+---+---+---+
| Insertion | | 0 | 1 | 0 | 0 |
+---------+---+---+---+---+---+

View File

@ -0,0 +1,26 @@
##### Initialisation
# la liste des cartes
cartes = [101011, 110111, 100111, 101010, 101100]
##### Tri
echange = True
# tant qu'on a échangé des cartes on continue à les ranger
while echange:
# Au début on a rien échangé
echange = False
# On va comparer les cartes 2 à 2
# i va décrire la position de la carte
# On va la comparer avec la suivante (i+1)
# i va aller de 1 au nombre de carte-1
for i in range(0, len(cartes)-1):
if cartes[i] > cartes[i+1]:
# si la carte i est plus grande que la carte i+1
# on les échanges
cartes[i], cartes[i+1] = cartes[i+1], cartes[i]
# On a fait un échange
echange = True
###### Fin
# On affiche les cartes triées
print(cartes)

View File

@ -0,0 +1,28 @@
##### Initialisation
# la liste des cartes
cartes = [101011, 110111, 100111, 101010, 101100]
# On rangera dant cartes_triees
cartes_triees = []
##### Tri
# tant qu'il reste des nombres dans cartes
# len compte les éléments d'une liste
while len(cartes) > 0:
# On prend la première carte grâce au [0]
candidat_min = cartes[0]
# On va la comparer avec toutes les autres
# i est la position de la carte à comparer il ira de 1 à len(carte)
for i in range(1, len(cartes)) :
# on compare la carte minimum à une carte
if candidat_min > cartes[i]:
# quand la carte est plus petite c'est celle là que l'on veut garder
candidat_min = cartes[i]
# On ajoute la plus petite dans la liste des cartes triées
cartes_triees.append(candidat_min)
# On la supprime des cartes à trier
cartes.remove(candidat_min)
##### Fin
# On affiche les cartes triées
print(cartes_triees)