2022-02-17 11:34:00 +00:00
|
|
|
{
|
|
|
|
"cells": [
|
|
|
|
{
|
|
|
|
"cell_type": "markdown",
|
2022-02-18 09:31:39 +00:00
|
|
|
"id": "70d4a95c",
|
2022-02-17 11:34:00 +00:00
|
|
|
"metadata": {},
|
|
|
|
"source": [
|
|
|
|
"# Étape 2: Variables, affectation et type"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "markdown",
|
2022-02-18 09:31:39 +00:00
|
|
|
"id": "01f35556",
|
2022-02-17 11:34:00 +00:00
|
|
|
"metadata": {},
|
|
|
|
"source": [
|
2022-02-18 09:31:39 +00:00
|
|
|
"### Trois types de variables\n",
|
|
|
|
"\n",
|
|
|
|
"En informatique "
|
2022-02-17 11:34:00 +00:00
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
|
|
|
"execution_count": null,
|
2022-02-18 09:31:39 +00:00
|
|
|
"id": "3dfc05ea",
|
2022-02-17 11:34:00 +00:00
|
|
|
"metadata": {},
|
|
|
|
"outputs": [],
|
|
|
|
"source": []
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "markdown",
|
2022-02-18 09:31:39 +00:00
|
|
|
"id": "07c32553",
|
2022-02-17 11:34:00 +00:00
|
|
|
"metadata": {},
|
|
|
|
"source": [
|
|
|
|
"`input` donne une chaine de caractère. Comment la transformer en int ou float"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
|
|
|
"execution_count": null,
|
2022-02-18 09:31:39 +00:00
|
|
|
"id": "b11ee13b",
|
2022-02-17 11:34:00 +00:00
|
|
|
"metadata": {},
|
|
|
|
"outputs": [],
|
|
|
|
"source": []
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "markdown",
|
2022-02-18 09:31:39 +00:00
|
|
|
"id": "978e9480",
|
2022-02-17 11:34:00 +00:00
|
|
|
"metadata": {},
|
|
|
|
"source": [
|
|
|
|
"Opérations entre les types"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
|
|
|
"execution_count": null,
|
2022-02-18 09:31:39 +00:00
|
|
|
"id": "4a7ca5f9",
|
2022-02-17 11:34:00 +00:00
|
|
|
"metadata": {},
|
|
|
|
"outputs": [],
|
|
|
|
"source": []
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "markdown",
|
2022-02-18 09:31:39 +00:00
|
|
|
"id": "192bd626",
|
2022-02-17 11:34:00 +00:00
|
|
|
"metadata": {},
|
|
|
|
"source": [
|
|
|
|
"## Exercices\n",
|
|
|
|
"\n",
|
|
|
|
"Dans les éxercices suivants vous devrez coder un programme qui fait ce qu'il est décrit. Vous pouvez les faire dans l'ordre que vous souhaitez."
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "markdown",
|
2022-02-18 09:31:39 +00:00
|
|
|
"id": "d4e53096",
|
2022-02-17 11:34:00 +00:00
|
|
|
"metadata": {},
|
|
|
|
"source": [
|
|
|
|
"### Variation d'une grandeur\n",
|
|
|
|
"\n",
|
|
|
|
"Écrire un programme qui\n",
|
|
|
|
"\n",
|
|
|
|
" demande la valeur initiale\n",
|
|
|
|
" demande le taux d'évolution\n",
|
|
|
|
" affiche la valeur finale"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
|
|
|
"execution_count": null,
|
2022-02-18 09:31:39 +00:00
|
|
|
"id": "eeb479d2",
|
2022-02-17 11:34:00 +00:00
|
|
|
"metadata": {},
|
|
|
|
"outputs": [],
|
|
|
|
"source": []
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "markdown",
|
2022-02-18 09:31:39 +00:00
|
|
|
"id": "705276dc",
|
2022-02-17 11:34:00 +00:00
|
|
|
"metadata": {},
|
|
|
|
"source": [
|
|
|
|
"## Taux de variation\n",
|
|
|
|
"\n",
|
|
|
|
"Écrire un programme qui\n",
|
|
|
|
"\n",
|
|
|
|
" demande la valeur initiale\n",
|
|
|
|
" demande la valeur finale\n",
|
|
|
|
" affiche le taux d'évolution\n"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
|
|
|
"execution_count": null,
|
2022-02-18 09:31:39 +00:00
|
|
|
"id": "b1a4755a",
|
2022-02-17 11:34:00 +00:00
|
|
|
"metadata": {},
|
|
|
|
"outputs": [],
|
|
|
|
"source": []
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "markdown",
|
2022-02-18 09:31:39 +00:00
|
|
|
"id": "1037725f",
|
2022-02-17 11:34:00 +00:00
|
|
|
"metadata": {},
|
|
|
|
"source": [
|
|
|
|
"### Coordonnées du milieu\n",
|
|
|
|
"\n",
|
|
|
|
"Écrire un programme qui\n",
|
|
|
|
"\n",
|
|
|
|
" demande l'abscisse du point A\n",
|
|
|
|
" demande l'ordonnée du point A\n",
|
|
|
|
" demande l'abscisse du point B\n",
|
|
|
|
" demande l'ordonnée du point B\n",
|
|
|
|
" stock l'abscisse du milieu du segment [AB]\n",
|
|
|
|
" stock l'ordonnée du milieu du segment [AB]\n",
|
|
|
|
" affiche les coordonnées du milieu du segment [AB]\n",
|
|
|
|
" "
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
|
|
|
"execution_count": null,
|
2022-02-18 09:31:39 +00:00
|
|
|
"id": "c2b735ba",
|
2022-02-17 11:34:00 +00:00
|
|
|
"metadata": {},
|
|
|
|
"outputs": [],
|
|
|
|
"source": []
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "markdown",
|
2022-02-18 09:31:39 +00:00
|
|
|
"id": "4d3ce1bf",
|
2022-02-17 11:34:00 +00:00
|
|
|
"metadata": {},
|
|
|
|
"source": [
|
|
|
|
"### Distance entre deux points\n",
|
|
|
|
"\n",
|
|
|
|
"Écrire un programme qui\n",
|
|
|
|
"\n",
|
|
|
|
" demande l'abscisse du point A\n",
|
|
|
|
" demande l'ordonnée du point A\n",
|
|
|
|
" demande l'abscisse du point B\n",
|
|
|
|
" demande l'ordonnée du point B\n",
|
|
|
|
" affiche la distance AB\n",
|
|
|
|
" \n",
|
|
|
|
"Pour calculer la racine carré, vous aurez besoin d'importer la fonction `sqrt`. Pour cela, votre programme devra commencer par la ligne suivante\n",
|
|
|
|
"\n",
|
|
|
|
" from math import sqrt"
|
|
|
|
]
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"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
|
|
|
|
}
|