183 lines
3.8 KiB
Plaintext
183 lines
3.8 KiB
Plaintext
|
{
|
||
|
"cells": [
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"id": "431d820f",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"# Étape 2: Variables, affectation et type"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"id": "68735bc5",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"Trois types de variables"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": null,
|
||
|
"id": "bb073084",
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": []
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"id": "a8e5dc45",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"`input` donne une chaine de caractère. Comment la transformer en int ou float"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": null,
|
||
|
"id": "549afdb8",
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": []
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"id": "ef52a1e0",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"Opérations entre les types"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": null,
|
||
|
"id": "0fa1ffb7",
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": []
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"id": "679b714c",
|
||
|
"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",
|
||
|
"id": "39db342d",
|
||
|
"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,
|
||
|
"id": "142f5abd",
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": []
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"id": "35b73400",
|
||
|
"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,
|
||
|
"id": "e7fb7e8e",
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": []
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"id": "16e4cab9",
|
||
|
"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,
|
||
|
"id": "e3766249",
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": []
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"id": "00c3137a",
|
||
|
"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
|
||
|
}
|