162 lines
3.0 KiB
Plaintext
162 lines
3.0 KiB
Plaintext
|
{
|
||
|
"cells": [
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"id": "59986333",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"# Conditions\n",
|
||
|
"\n",
|
||
|
"Quand on veut gérer des situations différentes, on utiliser une structure `if`."
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 2,
|
||
|
"id": "90f79825",
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"name": "stdout",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
"Choisir un nombre (a): 2\n",
|
||
|
"Choisir un autre nombre(b): 4\n",
|
||
|
"a est plus petit que b\n"
|
||
|
]
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"a = str(input(\"Choisir un nombre (a): \"))\n",
|
||
|
"b = str(input(\"Choisir un autre nombre(b): \"))\n",
|
||
|
"\n",
|
||
|
"if a > b: # Si\n",
|
||
|
" print(\"a plus grand que b\")\n",
|
||
|
"elif a == b: # Sinon si\n",
|
||
|
" print(\"a est égal à b\")\n",
|
||
|
"else: # Sinon\n",
|
||
|
" print(\"a est plus petit que b\")"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"id": "6e39d9d8",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"## Exercices"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"id": "21e86bf8",
|
||
|
"metadata": {},
|
||
|
"source": []
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": null,
|
||
|
"id": "f719d9ac",
|
||
|
"metadata": {
|
||
|
"collapsed": true
|
||
|
},
|
||
|
"outputs": [],
|
||
|
"source": []
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"id": "56711adc",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"2. **Questions flashs et correction automatique**\n",
|
||
|
"\n",
|
||
|
"Préparer une série de 4 questions flashs simples où la réponse est un nombre ou un mot. Écrire un programme qui demande une réponse aux questions flashs et qui dit si oui ou non la réponse est juste."
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": null,
|
||
|
"id": "01e13ca3",
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": []
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"id": "7e24624a",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"# Comparaison et logique"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"id": "a140ea9c",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"==, !=, <, >, <= et >="
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": null,
|
||
|
"id": "b60a11dd",
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": []
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"id": "a4a0f415",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"not, and et or"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": null,
|
||
|
"id": "3f3512da",
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": []
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"id": "4f4b6948",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"## Exercices"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": null,
|
||
|
"id": "2aad72c0",
|
||
|
"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
|
||
|
}
|