Feta: tous les bilans (à retravailler avec Camille je pense...)
This commit is contained in:
parent
83d6636512
commit
f63d8e2ed3
@ -179,7 +179,7 @@
|
||||
"id": "a801961d",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"Faire la liste des opérateurs et écrire une phrase pour décrire ce qu'ils signifie."
|
||||
"4.Faire la liste des opérateurs et écrire une phrase pour décrire ce qu'ils signifie."
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -198,27 +198,40 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"execution_count": 1,
|
||||
"id": "3f3512da",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"True\n",
|
||||
"False\n",
|
||||
"False\n",
|
||||
"---------------\n",
|
||||
"True\n",
|
||||
"True\n",
|
||||
"False\n",
|
||||
"---------------\n",
|
||||
"False\n",
|
||||
"False\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"print(2 == 2 and 4 == 4)\n",
|
||||
"print(2 == )"
|
||||
"print(2 == 2 and 3 == 4)\n",
|
||||
"print(2 == 3 and 3 == 4)\n",
|
||||
"print(\"---------------\")\n",
|
||||
"print(2 == 2 or 4 == 4)\n",
|
||||
"print(2 == 2 or 3 == 4)\n",
|
||||
"print(2 == 3 or 3 == 4)\n",
|
||||
"print(\"---------------\")\n",
|
||||
"print(not 2 == 2)\n",
|
||||
"print(not 2 == 2)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "acee5b14",
|
||||
"metadata": {},
|
||||
"source": []
|
||||
},
|
||||
{
|
||||
"cell_type": "raw",
|
||||
"id": "565d9da6",
|
||||
"metadata": {},
|
||||
"source": []
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "4f4b6948",
|
||||
@ -227,6 +240,37 @@
|
||||
"## Exercices"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "3a84f519",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"5. Programmer une IA au jeu Que-est-ce?\n",
|
||||
"\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "1121ba84",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "088cdb91",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"6. Programmer un pierre-feuille-ciseau. \n",
|
||||
"\n",
|
||||
"Déroulé du programme:\n",
|
||||
"\n",
|
||||
"L'utilisateur choisit un nombre entre 0 (pierre), 1(feuille), 2(ciseau).\n",
|
||||
"L'ordinateur choisit au hasard un nombre en 0 et 2 (vous pourrez utiliser `randint(0, 2)` pour faire cela.\n",
|
||||
"L'ordinateur détermine qui a gagné la partie"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
|
Binary file not shown.
@ -14,7 +14,7 @@
|
||||
|
||||
\section{Boucle \lstinline{for}}
|
||||
|
||||
Quand on veut \textbf{faire} quelque chose un nombre de foi connus quelque chose, on utilise une 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}
|
||||
|
81
2nd/13_Programmation/4E_boucle_for.ipynb
Normal file
81
2nd/13_Programmation/4E_boucle_for.ipynb
Normal file
@ -0,0 +1,81 @@
|
||||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "701f30c9",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"# Étape 4: boucle for"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "9fcf4959",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## Faire la même chose plusieurs fois"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "601ff306",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "9880d494",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"##"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "0c00b54a",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "f69cc71e",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "27810bbd",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "Python 3 (ipykernel)",
|
||||
"language": "python",
|
||||
"name": "python3"
|
||||
},
|
||||
"language_info": {
|
||||
"codemirror_mode": {
|
||||
"name": "ipython",
|
||||
"version": 3
|
||||
},
|
||||
"file_extension": ".py",
|
||||
"mimetype": "text/x-python",
|
||||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.10.2"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 5
|
||||
}
|
BIN
2nd/13_Programmation/5B_boucle_while.pdf
Normal file
BIN
2nd/13_Programmation/5B_boucle_while.pdf
Normal file
Binary file not shown.
52
2nd/13_Programmation/5B_boucle_while.tex
Normal file
52
2nd/13_Programmation/5B_boucle_while.tex
Normal file
@ -0,0 +1,52 @@
|
||||
\documentclass[a4paper,10pt]{article}
|
||||
\usepackage{myXsim}
|
||||
|
||||
\author{Benjamin Bertrand}
|
||||
\title{Programmation - Cours}
|
||||
\date{Février 2022}
|
||||
|
||||
\pagestyle{empty}
|
||||
|
||||
\begin{document}
|
||||
|
||||
\maketitle
|
||||
\setcounter{section}{4}
|
||||
|
||||
\section{Boucle \lstinline{while}}
|
||||
|
||||
Quand on veut \textbf{faire} quelque chose \textbf{tant que} quelque chose reste vrai, on utilise une boucle \lstinline{while}.
|
||||
|
||||
\begin{multicols}{3}
|
||||
\begin{minipage}{0.8\linewidth}
|
||||
\begin{lstlisting}
|
||||
n = 0
|
||||
u = 1
|
||||
print(u)
|
||||
while n < 5:
|
||||
n = n + 1
|
||||
u = u * 2
|
||||
print(u)\end{lstlisting}
|
||||
\end{minipage}
|
||||
|
||||
\columnbreak
|
||||
|
||||
Tableau des variables
|
||||
\begin{center}
|
||||
\begin{tabular}{c|c}
|
||||
n & u \\
|
||||
\hline
|
||||
& \\
|
||||
& \\
|
||||
& \\
|
||||
\end{tabular}
|
||||
\end{center}
|
||||
\columnbreak
|
||||
|
||||
Le programme va afficher
|
||||
|
||||
|
||||
\end{multicols}
|
||||
|
||||
\afaire{Prévoir ce que vont afficher ces deux programmes et compléter le tableau des variables}
|
||||
|
||||
\end{document}
|
BIN
2nd/13_Programmation/6B_fonctions.pdf
Normal file
BIN
2nd/13_Programmation/6B_fonctions.pdf
Normal file
Binary file not shown.
62
2nd/13_Programmation/6B_fonctions.tex
Normal file
62
2nd/13_Programmation/6B_fonctions.tex
Normal file
@ -0,0 +1,62 @@
|
||||
\documentclass[a4paper,10pt]{article}
|
||||
\usepackage{myXsim}
|
||||
|
||||
\author{Benjamin Bertrand}
|
||||
\title{Programmation - Cours}
|
||||
\date{Février 2022}
|
||||
|
||||
\pagestyle{empty}
|
||||
|
||||
\begin{document}
|
||||
|
||||
\maketitle
|
||||
\setcounter{section}{5}
|
||||
|
||||
\section{Fonction - \lstinline{def/return}}
|
||||
|
||||
Une \textbf{fonction} en informatique est un sous programme à qui on va donner des paramètres (entre parenthèses) et qui retournera une valeur.
|
||||
|
||||
\bigskip
|
||||
|
||||
Fonction similaire aux fonctions en maths:
|
||||
\smallskip
|
||||
|
||||
\begin{minipage}{0.4\linewidth}
|
||||
\begin{lstlisting}
|
||||
def f(x):
|
||||
return x^2 + 2
|
||||
|
||||
print(f(3))
|
||||
print(f(-1))\end{lstlisting}
|
||||
\end{minipage}
|
||||
\hfill
|
||||
\begin{minipage}{0.5\linewidth}
|
||||
|
||||
Le programme va afficher
|
||||
\vspace{2cm}
|
||||
\end{minipage}
|
||||
|
||||
Fonctions qui décore du texte
|
||||
|
||||
\begin{minipage}{0.55\linewidth}
|
||||
\begin{lstlisting}
|
||||
def decore(texte):
|
||||
return "*"*4 + texte + "*"*4
|
||||
|
||||
def belledeco(texte, decoration):
|
||||
return decoration*5 + texte + decoration*5
|
||||
|
||||
print(decore("Coucou c'est moi"))
|
||||
print(decore("Je suis trop beau!"))
|
||||
|
||||
print(belledeco("Coucou c'est moi", "="))
|
||||
print(belledeco("Je suis trop beau!", "a"))\end{lstlisting}
|
||||
\end{minipage}
|
||||
\hfill
|
||||
\begin{minipage}{0.4\linewidth}
|
||||
|
||||
Le programme va afficher
|
||||
\vspace{3cm}
|
||||
\end{minipage}
|
||||
|
||||
\end{document}
|
@ -97,9 +97,23 @@ Bilan:
|
||||
Étape 5: Boucle While
|
||||
---------------------
|
||||
|
||||
Bilan:
|
||||
|
||||
.. image:: ./5B_boucle_while.pdf
|
||||
:height: 200px
|
||||
:alt: Bilan sur la boucle while
|
||||
|
||||
|
||||
Étape 6: Fonctions
|
||||
------------------
|
||||
|
||||
Bilan:
|
||||
|
||||
.. image:: ./6B_fonctions.pdf
|
||||
:height: 200px
|
||||
:alt: Bilan sur les fonctions
|
||||
|
||||
|
||||
Étape 7: Projets
|
||||
----------------
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user