2021-2022/2nd/13_Programmation/2E_variables.ipynb

185 lines
3.8 KiB
Plaintext

{
"cells": [
{
"cell_type": "markdown",
"id": "70d4a95c",
"metadata": {},
"source": [
"# Étape 2: Variables, affectation et type"
]
},
{
"cell_type": "markdown",
"id": "01f35556",
"metadata": {},
"source": [
"### Trois types de variables\n",
"\n",
"En informatique "
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "3dfc05ea",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
"id": "07c32553",
"metadata": {},
"source": [
"`input` donne une chaine de caractère. Comment la transformer en int ou float"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "b11ee13b",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
"id": "978e9480",
"metadata": {},
"source": [
"Opérations entre les types"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "4a7ca5f9",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
"id": "192bd626",
"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": "d4e53096",
"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": "eeb479d2",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
"id": "705276dc",
"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": "b1a4755a",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
"id": "1037725f",
"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": "c2b735ba",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
"id": "4d3ce1bf",
"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
}