2021-2022/2nd/02_Information_chiffree_1/3_initiation_programmation....

472 lines
9.5 KiB
Plaintext
Raw Normal View History

{
"cells": [
{
"cell_type": "markdown",
"id": "6237e658",
"metadata": {},
"source": [
"# Automatisation du calcul de réduction\n",
"\n",
"Dans ce TP nous allons chercher à programmer le calcul que vous avez fait sur les réductions. Il est trop long, il sera difficile d'aller jusqu'au bout. Essayer d'aller aussi loin que vous le pouvez.\n"
]
},
{
"cell_type": "markdown",
"id": "95ecab26",
"metadata": {},
"source": [
"## L'ordinateur une grosse calculatrice\n",
"\n",
"Un ordinateur n'est ni plus ni moins qu'une calculatrice qui sait faire des calculs très rapidement. Nous allons l'utilser de cette manière.\n",
"\n",
"Pour cela, il suffit d'écrire les calculs que l'on souhaite qu'il réalise.\n",
"\n",
"La case ci-dessous a été préremplie par un calcul. Pour que l'ordinateur exécute ce calcul il faut appuyer sur `Shift` et `Entrer`."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "f576a354",
"metadata": {},
"outputs": [],
"source": [
"54.3*(1-20/100)"
]
},
{
"cell_type": "markdown",
"id": "4803e888",
"metadata": {},
"source": [
"Dans la case en dessous, calculer la quantité\n",
"$$87\\times(1 - \\dfrac{3}{100})$$"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "2ef55f83",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
"id": "31bea724",
"metadata": {},
"source": [
"Il est possible de calculer des résultats intermédiaires d'un calcul.\n",
"\n",
"Pour calculer une remise de 3% d'un objet qui coûte 89€. Peut-faire"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "5aff921c",
"metadata": {},
"outputs": [],
"source": [
"remise = 89*3/100\n",
"89 - remise"
]
},
{
"cell_type": "markdown",
"id": "add64549",
"metadata": {},
"source": [
"On propose une réduction de 30% sur un objet qui coûte 45€. Calculer son nouveau prix dans la case en dessous."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "ac752fd0",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
"id": "f55c2126",
"metadata": {},
"source": [
"### Exercices\n",
"\n",
"Les exercices suivants doivent être résolus grace à un ou plusieurs calculs fait avec l'ordinateur.\n",
"\n",
"1. Un jeu coûte 23€. On a une remise de 5€. Quel prix va-t-on le payer?"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "aec7c3af",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
"id": "b97cc383",
"metadata": {},
"source": [
"2. On a déjà fait 22km à pied. Il nous reste 3km à parcourir avant de terminer notre balade. Quelle est la longueur de notre balade?"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "51bb3b9a",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
"id": "4930695a",
"metadata": {},
"source": [
"3. Un jouet coûte 78.9€. On a une remise de 8% dessus. Quel peut-on l'acheter?"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "4acef7a9",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
"id": "27d4e371",
"metadata": {},
"source": [
"4. Un enfant mesure 52cm à la naissance. Il a grandit de 15% le premier mois. Combien mesure-t-il à un mois?"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "ff0cff7a",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
"id": "6db2272b",
"metadata": {},
"source": [
"5. Sur 150 candidats inscrit à l'examen, 120 ont été admis. Calculer la proportion de candidats admis."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "208b9556",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
"id": "957e6ab0",
"metadata": {},
"source": [
"## Retour aux réductions\n",
"\n",
"On reprend nos réductions:\n",
"\n",
"![Réductions](http://threeacts.mrmeyer.com/duelingdiscounts/act1/act1.jpg)\n",
"\n",
"Ecrire les calculs necessaires pour déterminer quel est la réduction la plus profitable pour les objets suivants"
]
},
{
"cell_type": "markdown",
"id": "827c0ae1",
"metadata": {},
"source": [
"1. \n",
"\n",
"![image - the converse shoes](http://threeacts.mrmeyer.com/duelingdiscounts/act2/converse.jpg)\n",
"\n",
"Réduction de 20$"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "6b933b52",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
"id": "23a74fea",
"metadata": {},
"source": [
"Réduction de 20%"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "4d872eed",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
"id": "4aa81830",
"metadata": {},
"source": [
"Réduction la plus interessante"
]
},
{
"cell_type": "markdown",
"id": "3be48a56",
"metadata": {},
"source": []
},
{
"cell_type": "markdown",
"id": "26cb8f66",
"metadata": {},
"source": [
"2. ![image - the desk](http://threeacts.mrmeyer.com/duelingdiscounts/act2/desk-birch.jpg)\n",
"\n",
"Réduction de 20$"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "8cbd2aae",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
"id": "43520d53",
"metadata": {},
"source": [
"Réduction de 20%"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "adda4e36",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
"id": "a7d6484c",
"metadata": {},
"source": [
"Réduction la plus interessante"
]
},
{
"cell_type": "markdown",
"id": "38001b01",
"metadata": {},
"source": []
},
{
"cell_type": "markdown",
"id": "db6d3e97",
"metadata": {},
"source": [
"3. ![image - the nightstand](http://threeacts.mrmeyer.com/duelingdiscounts/act2/nightstand.jpg)\n",
"\n",
"Réduction de 20$"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "aca699dc",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
"id": "8c00ddd9",
"metadata": {},
"source": [
"Réduction de 20%"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "4f51974c",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
"id": "91b8eadf",
"metadata": {},
"source": [
"Réduction la plus interessante"
]
},
{
"cell_type": "markdown",
"id": "567ea20e",
"metadata": {},
"source": []
},
{
"cell_type": "markdown",
"id": "3a55b8a6",
"metadata": {},
"source": [
"4. ![image - the TV](http://threeacts.mrmeyer.com/duelingdiscounts/act2/widescrntv.jpg)\n",
"\n",
"Réduction de 20$"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "c7f4311a",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
"id": "fe23f46c",
"metadata": {},
"source": [
"Réduction de 20%"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "a838d730",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
"id": "143f0220",
"metadata": {},
"source": [
"Réduction la plus interessante"
]
},
{
"cell_type": "markdown",
"id": "f950acf9",
"metadata": {},
"source": []
},
{
"cell_type": "markdown",
"id": "d745e02e",
"metadata": {},
"source": [
"## Automatiser la prise de décision\n",
"\n",
"Lire le programme suivant, changer le prix initial et expliquer ce qu'il fait"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "01396093",
"metadata": {},
"outputs": [],
"source": [
"prix_initial = 89\n",
"prix_reduction_1 = prix_initial - 10\n",
"prix_reduction_2 = prix_initial * (1 - 10/100)\n",
"if prix_reduction_1 > prix_reduction_2:\n",
" print(\"On choisit la réduction 2\")\n",
"else:\n",
" print(\"On choisit la réduction 1\")"
]
},
{
"cell_type": "markdown",
"id": "26ecd479",
"metadata": {},
"source": [
"Réécrire le programme ci-dessus en l'adaptant aux contraintes de notre exercice sur les réductions."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "db985b48",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"id": "9732ecc6",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"id": "47912809",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"id": "377a80ef",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"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.9.6"
}
},
"nbformat": 4,
"nbformat_minor": 5
}