{"id":34,"date":"2025-09-07T18:43:37","date_gmt":"2025-09-07T16:43:37","guid":{"rendered":"https:\/\/yb-isn.fr\/2025\/nsi\/?p=34"},"modified":"2025-09-13T11:44:05","modified_gmt":"2025-09-13T09:44:05","slug":"3-les-variables","status":"publish","type":"post","link":"https:\/\/yb-isn.fr\/2025\/nsi\/2025\/09\/07\/3-les-variables\/","title":{"rendered":"3-Les variables"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\"><strong>Corrig\u00e9 des exercices de la partie 5 ci dessous<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/capytale2.ac-paris.fr\/web\/c\/7218-3918336\">https:\/\/capytale2.ac-paris.fr\/web\/c\/7218-3918336<\/a><\/p>\n\n\n<p><!--more--><\/p>\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Une variable est une \u00e9tiquette permettant d\u2019identifier une zone de la m\u00e9moire stockant une valeur qui lui a \u00e9t\u00e9 affect\u00e9e.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Une variable donn\u00e9e a&nbsp;:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>un type qui d\u00e9pend de la nature de la valeur stock\u00e9e (typage dynamique)<\/li>\n\n\n\n<li>Une taille en m\u00e9moire (nombre de bit ou d\u2019octets. Python g\u00e8re la m\u00e9moire pour vous)<\/li>\n\n\n\n<li>Un nom<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Le nom doit respecter certaines r\u00e8gles&nbsp;:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Ne commence pas par un chiffre<\/li>\n\n\n\n<li>Lettres minuscules MAJUSCULES&nbsp; underscore_ et chiffres<\/li>\n\n\n\n<li>Les mots r\u00e9serv\u00e9s ne sont pas autoris\u00e9s (voir coloration synthaxique)<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Nous allons \u00e9tudier 4 types de variables&nbsp;: <strong>int , float , str <\/strong>et<strong> bool<\/strong><\/p>\n\n\n\n<p class=\"has-black-color has-text-color has-background has-link-color wp-elements-b22acf49d30163d08c12856b3a835a84 wp-block-paragraph\" style=\"background:linear-gradient(135deg,rgb(216,244,179) 0%,rgb(17,184,81) 100%)\"><strong>1) variable de type int<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Une variable de type int permet de r\u00e9f\u00e9rencer des entiers naturels ou des entiers relatifs.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">La taille n\u2019est limit\u00e9e que par la m\u00e9moire de la machine.<\/p>\n\n\n\n<div class=\"wp-block-esab-accordion accordion-346284fc\" data-mode=\"global\"><div class=\"esab__container\">\n<div class=\"wp-block-esab-accordion-child\"><div class=\"esab__head\" role=\"button\" aria-expanded=\"false\"><div class=\"esab__heading_txt\"><p class=\"esab__heading_tag\">\ud83c\udfcb\ufe0f Effectuer vos propres tests dans une console python (thonny par exemple)<\/p><\/div><div class=\"esab__icon\"><div class=\"esab__collapse\"> <svg version=\"1.2\" viewBox=\"0 0 24 24\" width=\"24\" height=\"24\"><path fill-rule=\"evenodd\" d=\"m3.5 20.5c-4.7-4.7-4.7-12.3 0-17 4.7-4.7 12.3-4.7 17 0 4.6 4.7 4.6 12.3 0 17-4.7 4.6-12.3 4.6-17 0zm0.9-0.9c4.2 4.2 11 4.2 15.2 0 4.2-4.2 4.2-11 0-15.2-4.2-4.3-11-4.3-15.2 0-4.3 4.2-4.3 11 0 15.2z\"><\/path><path d=\"m11.4 15.9v-3.3h-3.3c-0.3 0-0.6-0.3-0.6-0.6 0-0.4 0.3-0.6 0.6-0.6h3.3v-3.3c0-0.3 0.3-0.6 0.6-0.6 0.3 0 0.6 0.3 0.6 0.6v3.3h3.3c0.3 0 0.6 0.2 0.6 0.6q0 0.2-0.2 0.4-0.2 0.2-0.4 0.2h-3.3v3.3q0 0.2-0.2 0.4-0.2 0.2-0.4 0.2c-0.4 0-0.6-0.3-0.6-0.6z\"><\/path><\/svg> <\/div><div class=\"esab__expand\"> <svg version=\"1.2\" viewBox=\"0 0 24 24\" width=\"24\" height=\"24\"><path fill-rule=\"evenodd\" d=\"m12 24c-6.6 0-12-5.4-12-12 0-6.6 5.4-12 12-12 6.6 0 12 5.4 12 12 0 6.6-5.4 12-12 12zm10.6-12c0-5.9-4.7-10.6-10.6-10.6-5.9 0-10.6 4.7-10.6 10.6 0 5.9 4.7 10.6 10.6 10.6 5.9 0 10.6-4.7 10.6-10.6z\"><\/path><path d=\"m5.6 11.3h12.8v1.4h-12.8z\"><\/path><\/svg> <\/div><\/div><\/div><div class=\"esab__body\">\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/yb-isn.fr\/2023\/nsi\/wp-content\/uploads\/2023\/09\/Sans-titre-14.png\" alt=\"\" class=\"wp-image-159\"\/><\/figure>\n<\/div><\/div>\n<\/div><\/div>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"has-black-color has-text-color has-background has-link-color wp-elements-266c0764a490028344776af65e67fc2c wp-block-paragraph\" style=\"background:linear-gradient(135deg,rgb(216,244,179) 0%,rgb(17,184,81) 100%)\"><strong>2) variable de type float<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">On utilise le type float pour repr\u00e9senter les nombres r\u00e9els. La pr\u00e9cision est limit\u00e9e m\u00eame si elle est largement suffisante pour beaucoup d\u2019usages.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>La virgule d\u2019un nombre d\u00e9cimal se note avec un point en python<\/strong><\/p>\n\n\n\n<div class=\"wp-block-esab-accordion accordion-d5e23270\" data-mode=\"global\"><div class=\"esab__container\">\n<div class=\"wp-block-esab-accordion-child\"><div class=\"esab__head\" role=\"button\" aria-expanded=\"false\"><div class=\"esab__heading_txt\"><p class=\"esab__heading_tag\">\ud83c\udfcb\ufe0f D\u00e9clarez une variable en lui affectant une valeur d\u00e9cimale puis rechercher son type.<\/p><\/div><div class=\"esab__icon\"><div class=\"esab__collapse\"> <svg version=\"1.2\" viewBox=\"0 0 24 24\" width=\"24\" height=\"24\"><path fill-rule=\"evenodd\" d=\"m3.5 20.5c-4.7-4.7-4.7-12.3 0-17 4.7-4.7 12.3-4.7 17 0 4.6 4.7 4.6 12.3 0 17-4.7 4.6-12.3 4.6-17 0zm0.9-0.9c4.2 4.2 11 4.2 15.2 0 4.2-4.2 4.2-11 0-15.2-4.2-4.3-11-4.3-15.2 0-4.3 4.2-4.3 11 0 15.2z\"><\/path><path d=\"m11.4 15.9v-3.3h-3.3c-0.3 0-0.6-0.3-0.6-0.6 0-0.4 0.3-0.6 0.6-0.6h3.3v-3.3c0-0.3 0.3-0.6 0.6-0.6 0.3 0 0.6 0.3 0.6 0.6v3.3h3.3c0.3 0 0.6 0.2 0.6 0.6q0 0.2-0.2 0.4-0.2 0.2-0.4 0.2h-3.3v3.3q0 0.2-0.2 0.4-0.2 0.2-0.4 0.2c-0.4 0-0.6-0.3-0.6-0.6z\"><\/path><\/svg> <\/div><div class=\"esab__expand\"> <svg version=\"1.2\" viewBox=\"0 0 24 24\" width=\"24\" height=\"24\"><path fill-rule=\"evenodd\" d=\"m12 24c-6.6 0-12-5.4-12-12 0-6.6 5.4-12 12-12 6.6 0 12 5.4 12 12 0 6.6-5.4 12-12 12zm10.6-12c0-5.9-4.7-10.6-10.6-10.6-5.9 0-10.6 4.7-10.6 10.6 0 5.9 4.7 10.6 10.6 10.6 5.9 0 10.6-4.7 10.6-10.6z\"><\/path><path d=\"m5.6 11.3h12.8v1.4h-12.8z\"><\/path><\/svg> <\/div><\/div><\/div><div class=\"esab__body\">\n<p class=\"wp-block-paragraph\"><img decoding=\"async\" src=\"http:\/\/yb-isn.fr\/nsi2019\/wp-content\/uploads\/2019\/09\/Sans-titre-15.png\" alt=\"L\u2019attribut alt de cette image est vide, son nom de fichier est Sans-titre-15.png.\"><\/p>\n<\/div><\/div>\n<\/div><\/div>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Les puissances de 10 se notent avec e ou<\/strong> <strong>E<\/strong><\/p>\n\n\n\n<div class=\"wp-block-esab-accordion accordion-ecfcb1c8\" data-mode=\"global\"><div class=\"esab__container\">\n<div class=\"wp-block-esab-accordion-child\"><div class=\"esab__head\" role=\"button\" aria-expanded=\"false\"><div class=\"esab__heading_txt\"><p class=\"esab__heading_tag\">\ud83c\udfcb\ufe0f Le rayon de la terre est \u00e9gal \u00e0 6380km. <br>D\u00e9clarez une variable pour lui affecter le rayon\u00a0 de la terre en notation scientifique en m. Afficher la valeur ainsi que son type<\/p><\/div><div class=\"esab__icon\"><div class=\"esab__collapse\"> <svg version=\"1.2\" viewBox=\"0 0 24 24\" width=\"24\" height=\"24\"><path fill-rule=\"evenodd\" d=\"m3.5 20.5c-4.7-4.7-4.7-12.3 0-17 4.7-4.7 12.3-4.7 17 0 4.6 4.7 4.6 12.3 0 17-4.7 4.6-12.3 4.6-17 0zm0.9-0.9c4.2 4.2 11 4.2 15.2 0 4.2-4.2 4.2-11 0-15.2-4.2-4.3-11-4.3-15.2 0-4.3 4.2-4.3 11 0 15.2z\"><\/path><path d=\"m11.4 15.9v-3.3h-3.3c-0.3 0-0.6-0.3-0.6-0.6 0-0.4 0.3-0.6 0.6-0.6h3.3v-3.3c0-0.3 0.3-0.6 0.6-0.6 0.3 0 0.6 0.3 0.6 0.6v3.3h3.3c0.3 0 0.6 0.2 0.6 0.6q0 0.2-0.2 0.4-0.2 0.2-0.4 0.2h-3.3v3.3q0 0.2-0.2 0.4-0.2 0.2-0.4 0.2c-0.4 0-0.6-0.3-0.6-0.6z\"><\/path><\/svg> <\/div><div class=\"esab__expand\"> <svg version=\"1.2\" viewBox=\"0 0 24 24\" width=\"24\" height=\"24\"><path fill-rule=\"evenodd\" d=\"m12 24c-6.6 0-12-5.4-12-12 0-6.6 5.4-12 12-12 6.6 0 12 5.4 12 12 0 6.6-5.4 12-12 12zm10.6-12c0-5.9-4.7-10.6-10.6-10.6-5.9 0-10.6 4.7-10.6 10.6 0 5.9 4.7 10.6 10.6 10.6 5.9 0 10.6-4.7 10.6-10.6z\"><\/path><path d=\"m5.6 11.3h12.8v1.4h-12.8z\"><\/path><\/svg> <\/div><\/div><\/div><div class=\"esab__body\">\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/yb-isn.fr\/2023\/nsi\/wp-content\/uploads\/2023\/09\/Sans-titre-16-1.png\" alt=\"\" class=\"wp-image-162\"\/><\/figure>\n<\/div><\/div>\n<\/div><\/div>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"has-black-color has-text-color has-background has-link-color wp-elements-75fc6192de6d1406c40b1bac301578f6 wp-block-paragraph\" style=\"background:linear-gradient(135deg,rgb(216,244,179) 0%,rgb(17,184,81) 100%)\">3) <strong>variable de type str<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Une variable r\u00e9f\u00e9ren\u00e7ant une cha\u00eene de caract\u00e8res est de type <strong>str<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Pour enregistrer une chaine de caract\u00e8res dans une variable il faut utiliser des guillemets (\u00ab ) ou des apostrophes (\u2018)<\/p>\n\n\n\n<div class=\"wp-block-esab-accordion accordion-e2d43a7e\" data-mode=\"global\"><div class=\"esab__container\">\n<div class=\"wp-block-esab-accordion-child\"><div class=\"esab__head\" role=\"button\" aria-expanded=\"false\"><div class=\"esab__heading_txt\"><p class=\"esab__heading_tag\">\ud83c\udfcb\ufe0f testez les codes ci-dessous<\/p><\/div><div class=\"esab__icon\"><div class=\"esab__collapse\"> <svg version=\"1.2\" viewBox=\"0 0 24 24\" width=\"24\" height=\"24\"><path fill-rule=\"evenodd\" d=\"m3.5 20.5c-4.7-4.7-4.7-12.3 0-17 4.7-4.7 12.3-4.7 17 0 4.6 4.7 4.6 12.3 0 17-4.7 4.6-12.3 4.6-17 0zm0.9-0.9c4.2 4.2 11 4.2 15.2 0 4.2-4.2 4.2-11 0-15.2-4.2-4.3-11-4.3-15.2 0-4.3 4.2-4.3 11 0 15.2z\"><\/path><path d=\"m11.4 15.9v-3.3h-3.3c-0.3 0-0.6-0.3-0.6-0.6 0-0.4 0.3-0.6 0.6-0.6h3.3v-3.3c0-0.3 0.3-0.6 0.6-0.6 0.3 0 0.6 0.3 0.6 0.6v3.3h3.3c0.3 0 0.6 0.2 0.6 0.6q0 0.2-0.2 0.4-0.2 0.2-0.4 0.2h-3.3v3.3q0 0.2-0.2 0.4-0.2 0.2-0.4 0.2c-0.4 0-0.6-0.3-0.6-0.6z\"><\/path><\/svg> <\/div><div class=\"esab__expand\"> <svg version=\"1.2\" viewBox=\"0 0 24 24\" width=\"24\" height=\"24\"><path fill-rule=\"evenodd\" d=\"m12 24c-6.6 0-12-5.4-12-12 0-6.6 5.4-12 12-12 6.6 0 12 5.4 12 12 0 6.6-5.4 12-12 12zm10.6-12c0-5.9-4.7-10.6-10.6-10.6-5.9 0-10.6 4.7-10.6 10.6 0 5.9 4.7 10.6 10.6 10.6 5.9 0 10.6-4.7 10.6-10.6z\"><\/path><path d=\"m5.6 11.3h12.8v1.4h-12.8z\"><\/path><\/svg> <\/div><\/div><\/div><div class=\"esab__body\">\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/yb-isn.fr\/2023\/nsi\/wp-content\/uploads\/2023\/09\/Sans-titre-18.png\" alt=\"\" class=\"wp-image-166\"\/><\/figure>\n<\/div><\/div>\n<\/div><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">Si la cha\u00eene comporte une apostrophe il faut utiliser des guillemets.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">La fonction input()&nbsp;permet de demander \u00e0 l&rsquo;utilisateur de saisir une cha\u00eene de caract\u00e8res au clavier. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Le r\u00e9sultat doit \u00eatre affect\u00e9 \u00e0 une variable.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">a=input(\u00ab\u00a0Message affich\u00e9 \u00ab\u00a0)<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Le type renvoy\u00e9 est str m\u00eame si vous avez saisi un nombre.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Exemple<\/p>\n\n\n\n<div class=\"wp-block-esab-accordion accordion-ee565229\" data-mode=\"global\"><div class=\"esab__container\">\n<div class=\"wp-block-esab-accordion-child\"><div class=\"esab__head\" role=\"button\" aria-expanded=\"false\"><div class=\"esab__heading_txt\"><p class=\"esab__heading_tag\">\ud83c\udfcb\ufe0f Exemple<\/p><\/div><div class=\"esab__icon\"><div class=\"esab__collapse\"> <svg version=\"1.2\" viewBox=\"0 0 24 24\" width=\"24\" height=\"24\"><path fill-rule=\"evenodd\" d=\"m3.5 20.5c-4.7-4.7-4.7-12.3 0-17 4.7-4.7 12.3-4.7 17 0 4.6 4.7 4.6 12.3 0 17-4.7 4.6-12.3 4.6-17 0zm0.9-0.9c4.2 4.2 11 4.2 15.2 0 4.2-4.2 4.2-11 0-15.2-4.2-4.3-11-4.3-15.2 0-4.3 4.2-4.3 11 0 15.2z\"><\/path><path d=\"m11.4 15.9v-3.3h-3.3c-0.3 0-0.6-0.3-0.6-0.6 0-0.4 0.3-0.6 0.6-0.6h3.3v-3.3c0-0.3 0.3-0.6 0.6-0.6 0.3 0 0.6 0.3 0.6 0.6v3.3h3.3c0.3 0 0.6 0.2 0.6 0.6q0 0.2-0.2 0.4-0.2 0.2-0.4 0.2h-3.3v3.3q0 0.2-0.2 0.4-0.2 0.2-0.4 0.2c-0.4 0-0.6-0.3-0.6-0.6z\"><\/path><\/svg> <\/div><div class=\"esab__expand\"> <svg version=\"1.2\" viewBox=\"0 0 24 24\" width=\"24\" height=\"24\"><path fill-rule=\"evenodd\" d=\"m12 24c-6.6 0-12-5.4-12-12 0-6.6 5.4-12 12-12 6.6 0 12 5.4 12 12 0 6.6-5.4 12-12 12zm10.6-12c0-5.9-4.7-10.6-10.6-10.6-5.9 0-10.6 4.7-10.6 10.6 0 5.9 4.7 10.6 10.6 10.6 5.9 0 10.6-4.7 10.6-10.6z\"><\/path><path d=\"m5.6 11.3h12.8v1.4h-12.8z\"><\/path><\/svg> <\/div><\/div><\/div><div class=\"esab__body\">\n<figure class=\"wp-block-image size-full is-resized\"><img decoding=\"async\" src=\"https:\/\/yb-isn.fr\/2023\/nsi\/wp-content\/uploads\/2023\/09\/image-12.png\" alt=\"\" class=\"wp-image-174\" style=\"width:454px;height:215px\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">La note d&rsquo;svt est une chaine de caract\u00e8res<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img decoding=\"async\" src=\"https:\/\/yb-isn.fr\/2023\/nsi\/wp-content\/uploads\/2023\/09\/image-13.png\" alt=\"\" class=\"wp-image-175\" style=\"width:349px;height:167px\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">La note d&rsquo;svt est bien un nombre d\u00e9cimal.<\/p>\n<\/div><\/div>\n<\/div><\/div>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<div class=\"wp-block-esab-accordion accordion-53ea1961\" data-mode=\"global\"><div class=\"esab__container\">\n<div class=\"wp-block-esab-accordion-child\"><div class=\"esab__head\" role=\"button\" aria-expanded=\"false\"><div class=\"esab__heading_txt\"><p class=\"esab__heading_tag\">\ud83c\udfcb\ufe0f \u00e9crivons un programme qui vous demande votre note en SVT puis votre note en SPC.<br>Le programme doit calculer la moyenne et afficher la r\u00e9sultat.<\/p><\/div><div class=\"esab__icon\"><div class=\"esab__collapse\"> <svg version=\"1.2\" viewBox=\"0 0 24 24\" width=\"24\" height=\"24\"><path fill-rule=\"evenodd\" d=\"m3.5 20.5c-4.7-4.7-4.7-12.3 0-17 4.7-4.7 12.3-4.7 17 0 4.6 4.7 4.6 12.3 0 17-4.7 4.6-12.3 4.6-17 0zm0.9-0.9c4.2 4.2 11 4.2 15.2 0 4.2-4.2 4.2-11 0-15.2-4.2-4.3-11-4.3-15.2 0-4.3 4.2-4.3 11 0 15.2z\"><\/path><path d=\"m11.4 15.9v-3.3h-3.3c-0.3 0-0.6-0.3-0.6-0.6 0-0.4 0.3-0.6 0.6-0.6h3.3v-3.3c0-0.3 0.3-0.6 0.6-0.6 0.3 0 0.6 0.3 0.6 0.6v3.3h3.3c0.3 0 0.6 0.2 0.6 0.6q0 0.2-0.2 0.4-0.2 0.2-0.4 0.2h-3.3v3.3q0 0.2-0.2 0.4-0.2 0.2-0.4 0.2c-0.4 0-0.6-0.3-0.6-0.6z\"><\/path><\/svg> <\/div><div class=\"esab__expand\"> <svg version=\"1.2\" viewBox=\"0 0 24 24\" width=\"24\" height=\"24\"><path fill-rule=\"evenodd\" d=\"m12 24c-6.6 0-12-5.4-12-12 0-6.6 5.4-12 12-12 6.6 0 12 5.4 12 12 0 6.6-5.4 12-12 12zm10.6-12c0-5.9-4.7-10.6-10.6-10.6-5.9 0-10.6 4.7-10.6 10.6 0 5.9 4.7 10.6 10.6 10.6 5.9 0 10.6-4.7 10.6-10.6z\"><\/path><path d=\"m5.6 11.3h12.8v1.4h-12.8z\"><\/path><\/svg> <\/div><\/div><\/div><div class=\"esab__body\">\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">note_svt=input(\"Quelle est votre note en SVT ?  \")\nnote_svt=float(note_svt)\n\nnote_spc=float(input(\"Quelle est votre note en SPC ?  \"))\n\nmoyenne=(note_spc+note_svt)\/2\n\nprint(\"votre moyenne est \u00e9gale \u00e0 \",moyenne)<\/pre>\n<\/div><\/div>\n<\/div><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">Le caract\u00e8re # au d\u00e9but d&rsquo;une ligne permet d&rsquo;annoter votre programme. La ligne n&rsquo;est pas ex\u00e9cut\u00e9e.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">la note saisie au clavier en ligne 2 est de type str. Vous ne pourrez pas l&rsquo;utiliser pour calculer la moyenne sans la conversion de type de la ligne 3.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">On peut effectuer la saisie la conversion et l&rsquo;affectation en une seule ligne comme pour la note de spc en ligne 4. Cela n&rsquo;est cependant pas recommand\u00e9.<\/p>\n\n\n\n<p class=\"has-black-color has-text-color has-background has-link-color wp-elements-068532484f19a1cf61c9a7148fc16729 wp-block-paragraph\" style=\"background:linear-gradient(135deg,rgb(216,244,179) 0%,rgb(17,184,81) 100%)\">4) <strong>variable de type bool<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">George Boole<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img decoding=\"async\" src=\"https:\/\/yb-isn.fr\/2023\/nsi\/wp-content\/uploads\/2023\/09\/image-7.png\" alt=\"\" class=\"wp-image-167\" style=\"width:133px;height:160px\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Variable bool\u00e9enne qui ne peut prendre que deux \u00e9tats True ou False<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Nous verrons plus tard l&rsquo;int\u00e9r\u00eat de ce type de variable.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Si vous tapez <strong>False<\/strong> ou <strong>True<\/strong> dans la console python vous remarquez d\u2019apr\u00e8s la coloration que ces mots sont r\u00e9serv\u00e9s. Il en est de m\u00eame pour <strong>not or<\/strong> et <strong>and.<\/strong>Il en est de m\u00eame pour <strong>not or<\/strong> et <strong>and.<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<div class=\"wp-block-esab-accordion accordion-9916d28a\" data-mode=\"global\"><div class=\"esab__container\">\n<div class=\"wp-block-esab-accordion-child\"><div class=\"esab__head\" role=\"button\" aria-expanded=\"false\"><div class=\"esab__heading_txt\"><p class=\"esab__heading_tag\">\ud83c\udfcb\ufe0f D\u00e9clarez une variable etat en lui affectant la valeur True ou False puis rechercher son type et afficher la r\u00e9sultat.<\/p><\/div><div class=\"esab__icon\"><div class=\"esab__collapse\"> <svg version=\"1.2\" viewBox=\"0 0 24 24\" width=\"24\" height=\"24\"><path fill-rule=\"evenodd\" d=\"m3.5 20.5c-4.7-4.7-4.7-12.3 0-17 4.7-4.7 12.3-4.7 17 0 4.6 4.7 4.6 12.3 0 17-4.7 4.6-12.3 4.6-17 0zm0.9-0.9c4.2 4.2 11 4.2 15.2 0 4.2-4.2 4.2-11 0-15.2-4.2-4.3-11-4.3-15.2 0-4.3 4.2-4.3 11 0 15.2z\"><\/path><path d=\"m11.4 15.9v-3.3h-3.3c-0.3 0-0.6-0.3-0.6-0.6 0-0.4 0.3-0.6 0.6-0.6h3.3v-3.3c0-0.3 0.3-0.6 0.6-0.6 0.3 0 0.6 0.3 0.6 0.6v3.3h3.3c0.3 0 0.6 0.2 0.6 0.6q0 0.2-0.2 0.4-0.2 0.2-0.4 0.2h-3.3v3.3q0 0.2-0.2 0.4-0.2 0.2-0.4 0.2c-0.4 0-0.6-0.3-0.6-0.6z\"><\/path><\/svg> <\/div><div class=\"esab__expand\"> <svg version=\"1.2\" viewBox=\"0 0 24 24\" width=\"24\" height=\"24\"><path fill-rule=\"evenodd\" d=\"m12 24c-6.6 0-12-5.4-12-12 0-6.6 5.4-12 12-12 6.6 0 12 5.4 12 12 0 6.6-5.4 12-12 12zm10.6-12c0-5.9-4.7-10.6-10.6-10.6-5.9 0-10.6 4.7-10.6 10.6 0 5.9 4.7 10.6 10.6 10.6 5.9 0 10.6-4.7 10.6-10.6z\"><\/path><path d=\"m5.6 11.3h12.8v1.4h-12.8z\"><\/path><\/svg> <\/div><\/div><\/div><div class=\"esab__body\">\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/yb-isn.fr\/2023\/nsi\/wp-content\/uploads\/2023\/09\/Sans-titre-20.png\" alt=\"\" class=\"wp-image-168\"\/><\/figure>\n<\/div><\/div>\n<\/div><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">etat est une variable bool\u00e9enne qui ne peut prendre que deux valeurs True ou False c\u2019est-\u00e0-dire vrai ou faux.<\/p>\n\n\n\n<div class=\"wp-block-esab-accordion accordion-23f0d899\" data-mode=\"global\"><div class=\"esab__container\">\n<div class=\"wp-block-esab-accordion-child\"><div class=\"esab__head\" role=\"button\" aria-expanded=\"false\"><div class=\"esab__heading_txt\"><p class=\"esab__heading_tag\">\ud83c\udfcb\ufe0f <strong>no<\/strong>t est un op\u00e9rateur . Recopier puis remplir le tableau ci-dessous.<\/p><\/div><div class=\"esab__icon\"><div class=\"esab__collapse\"> <svg version=\"1.2\" viewBox=\"0 0 24 24\" width=\"24\" height=\"24\"><path fill-rule=\"evenodd\" d=\"m3.5 20.5c-4.7-4.7-4.7-12.3 0-17 4.7-4.7 12.3-4.7 17 0 4.6 4.7 4.6 12.3 0 17-4.7 4.6-12.3 4.6-17 0zm0.9-0.9c4.2 4.2 11 4.2 15.2 0 4.2-4.2 4.2-11 0-15.2-4.2-4.3-11-4.3-15.2 0-4.3 4.2-4.3 11 0 15.2z\"><\/path><path d=\"m11.4 15.9v-3.3h-3.3c-0.3 0-0.6-0.3-0.6-0.6 0-0.4 0.3-0.6 0.6-0.6h3.3v-3.3c0-0.3 0.3-0.6 0.6-0.6 0.3 0 0.6 0.3 0.6 0.6v3.3h3.3c0.3 0 0.6 0.2 0.6 0.6q0 0.2-0.2 0.4-0.2 0.2-0.4 0.2h-3.3v3.3q0 0.2-0.2 0.4-0.2 0.2-0.4 0.2c-0.4 0-0.6-0.3-0.6-0.6z\"><\/path><\/svg> <\/div><div class=\"esab__expand\"> <svg version=\"1.2\" viewBox=\"0 0 24 24\" width=\"24\" height=\"24\"><path fill-rule=\"evenodd\" d=\"m12 24c-6.6 0-12-5.4-12-12 0-6.6 5.4-12 12-12 6.6 0 12 5.4 12 12 0 6.6-5.4 12-12 12zm10.6-12c0-5.9-4.7-10.6-10.6-10.6-5.9 0-10.6 4.7-10.6 10.6 0 5.9 4.7 10.6 10.6 10.6 5.9 0 10.6-4.7 10.6-10.6z\"><\/path><path d=\"m5.6 11.3h12.8v1.4h-12.8z\"><\/path><\/svg> <\/div><\/div><\/div><div class=\"esab__body\">\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/yb-isn.fr\/2023\/nsi\/wp-content\/uploads\/2023\/09\/Sans-titre-19.png\" alt=\"\" class=\"wp-image-169\"\/><\/figure>\n<\/div><\/div>\n<\/div><\/div>\n\n\n\n<div class=\"wp-block-esab-accordion accordion-acc13269\" data-mode=\"global\"><div class=\"esab__container\">\n<div class=\"wp-block-esab-accordion-child\"><div class=\"esab__head\" role=\"button\" aria-expanded=\"false\"><div class=\"esab__heading_txt\"><p class=\"esab__heading_tag\">\ud83c\udfcb\ufe0f <strong>no<\/strong>t est un op\u00e9rateur . Recopier puis remplir le tableau ci-dessous.<\/p><\/div><div class=\"esab__icon\"><div class=\"esab__collapse\"> <svg version=\"1.2\" viewBox=\"0 0 24 24\" width=\"24\" height=\"24\"><path fill-rule=\"evenodd\" d=\"m3.5 20.5c-4.7-4.7-4.7-12.3 0-17 4.7-4.7 12.3-4.7 17 0 4.6 4.7 4.6 12.3 0 17-4.7 4.6-12.3 4.6-17 0zm0.9-0.9c4.2 4.2 11 4.2 15.2 0 4.2-4.2 4.2-11 0-15.2-4.2-4.3-11-4.3-15.2 0-4.3 4.2-4.3 11 0 15.2z\"><\/path><path d=\"m11.4 15.9v-3.3h-3.3c-0.3 0-0.6-0.3-0.6-0.6 0-0.4 0.3-0.6 0.6-0.6h3.3v-3.3c0-0.3 0.3-0.6 0.6-0.6 0.3 0 0.6 0.3 0.6 0.6v3.3h3.3c0.3 0 0.6 0.2 0.6 0.6q0 0.2-0.2 0.4-0.2 0.2-0.4 0.2h-3.3v3.3q0 0.2-0.2 0.4-0.2 0.2-0.4 0.2c-0.4 0-0.6-0.3-0.6-0.6z\"><\/path><\/svg> <\/div><div class=\"esab__expand\"> <svg version=\"1.2\" viewBox=\"0 0 24 24\" width=\"24\" height=\"24\"><path fill-rule=\"evenodd\" d=\"m12 24c-6.6 0-12-5.4-12-12 0-6.6 5.4-12 12-12 6.6 0 12 5.4 12 12 0 6.6-5.4 12-12 12zm10.6-12c0-5.9-4.7-10.6-10.6-10.6-5.9 0-10.6 4.7-10.6 10.6 0 5.9 4.7 10.6 10.6 10.6 5.9 0 10.6-4.7 10.6-10.6z\"><\/path><path d=\"m5.6 11.3h12.8v1.4h-12.8z\"><\/path><\/svg> <\/div><\/div><\/div><div class=\"esab__body\">\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/yb-isn.fr\/2023\/nsi\/wp-content\/uploads\/2023\/09\/Sans-titre-19.png\" alt=\"\" class=\"wp-image-169\"\/><\/figure>\n<\/div><\/div>\n<\/div><\/div>\n\n\n\n<div class=\"wp-block-esab-accordion accordion-03cc25d8\" data-mode=\"global\"><div class=\"esab__container\">\n<div class=\"wp-block-esab-accordion-child\"><div class=\"esab__head\" role=\"button\" aria-expanded=\"false\"><div class=\"esab__heading_txt\"><p class=\"esab__heading_tag\">\ud83c\udfcb\ufe0f Recopier puis remplir le tableau ci-dessous.<\/p><\/div><div class=\"esab__icon\"><div class=\"esab__collapse\"> <svg version=\"1.2\" viewBox=\"0 0 24 24\" width=\"24\" height=\"24\"><path fill-rule=\"evenodd\" d=\"m3.5 20.5c-4.7-4.7-4.7-12.3 0-17 4.7-4.7 12.3-4.7 17 0 4.6 4.7 4.6 12.3 0 17-4.7 4.6-12.3 4.6-17 0zm0.9-0.9c4.2 4.2 11 4.2 15.2 0 4.2-4.2 4.2-11 0-15.2-4.2-4.3-11-4.3-15.2 0-4.3 4.2-4.3 11 0 15.2z\"><\/path><path d=\"m11.4 15.9v-3.3h-3.3c-0.3 0-0.6-0.3-0.6-0.6 0-0.4 0.3-0.6 0.6-0.6h3.3v-3.3c0-0.3 0.3-0.6 0.6-0.6 0.3 0 0.6 0.3 0.6 0.6v3.3h3.3c0.3 0 0.6 0.2 0.6 0.6q0 0.2-0.2 0.4-0.2 0.2-0.4 0.2h-3.3v3.3q0 0.2-0.2 0.4-0.2 0.2-0.4 0.2c-0.4 0-0.6-0.3-0.6-0.6z\"><\/path><\/svg> <\/div><div class=\"esab__expand\"> <svg version=\"1.2\" viewBox=\"0 0 24 24\" width=\"24\" height=\"24\"><path fill-rule=\"evenodd\" d=\"m12 24c-6.6 0-12-5.4-12-12 0-6.6 5.4-12 12-12 6.6 0 12 5.4 12 12 0 6.6-5.4 12-12 12zm10.6-12c0-5.9-4.7-10.6-10.6-10.6-5.9 0-10.6 4.7-10.6 10.6 0 5.9 4.7 10.6 10.6 10.6 5.9 0 10.6-4.7 10.6-10.6z\"><\/path><path d=\"m5.6 11.3h12.8v1.4h-12.8z\"><\/path><\/svg> <\/div><\/div><\/div><div class=\"esab__body\">\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/yb-isn.fr\/2023\/nsi\/wp-content\/uploads\/2023\/09\/Sans-titre-22.png\" alt=\"\" class=\"wp-image-170\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">or signifie ou. Est ce un ou inclusif ou exclusif ?<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/yb-isn.fr\/2023\/nsi\/wp-content\/uploads\/2023\/09\/Sans-titre-23.png\" alt=\"\" class=\"wp-image-171\"\/><\/figure>\n<\/div><\/div>\n<\/div><\/div>\n\n\n\n<p class=\"has-black-color has-text-color has-background has-link-color wp-elements-a003ca0477898ded0eafe0f4530a5679 wp-block-paragraph\" style=\"background:linear-gradient(135deg,rgb(216,244,179) 0%,rgb(17,184,81) 100%)\">5) <strong>Exercices<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/capytale2.ac-paris.fr\/web\/c\/2705-3918569\">https:\/\/capytale2.ac-paris.fr\/web\/c\/2705-3918569<\/a><\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img decoding=\"async\" src=\"https:\/\/yb-isn.fr\/2024\/nsi\/wp-content\/uploads\/2024\/08\/image-5-1024x496.png\" alt=\"\" class=\"wp-image-121\" style=\"width:407px;height:auto\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Corrig\u00e9 des exercices de la partie 5 ci dessous https:\/\/capytale2.ac-paris.fr\/web\/c\/7218-3918336<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_crdt_document":"","footnotes":""},"categories":[1],"tags":[],"class_list":["post-34","post","type-post","status-publish","format-standard","hentry","category-non-classe"],"_links":{"self":[{"href":"https:\/\/yb-isn.fr\/2025\/nsi\/wp-json\/wp\/v2\/posts\/34","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/yb-isn.fr\/2025\/nsi\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/yb-isn.fr\/2025\/nsi\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/yb-isn.fr\/2025\/nsi\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/yb-isn.fr\/2025\/nsi\/wp-json\/wp\/v2\/comments?post=34"}],"version-history":[{"count":4,"href":"https:\/\/yb-isn.fr\/2025\/nsi\/wp-json\/wp\/v2\/posts\/34\/revisions"}],"predecessor-version":[{"id":48,"href":"https:\/\/yb-isn.fr\/2025\/nsi\/wp-json\/wp\/v2\/posts\/34\/revisions\/48"}],"wp:attachment":[{"href":"https:\/\/yb-isn.fr\/2025\/nsi\/wp-json\/wp\/v2\/media?parent=34"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/yb-isn.fr\/2025\/nsi\/wp-json\/wp\/v2\/categories?post=34"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/yb-isn.fr\/2025\/nsi\/wp-json\/wp\/v2\/tags?post=34"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}