{"id":1911,"date":"2020-04-11T18:39:35","date_gmt":"2020-04-11T16:39:35","guid":{"rendered":"http:\/\/www.ardpylab.fr\/?page_id=1911"},"modified":"2020-05-10T15:29:24","modified_gmt":"2020-05-10T13:29:24","slug":"les-tuples","status":"publish","type":"page","link":"https:\/\/www.ardpylab.fr\/?page_id=1911","title":{"rendered":"Les tuples"},"content":{"rendered":"\n<p><br>Les tuples sont des listes qui ne peuvent pas \u00eatre modifi\u00e9es. Ils sont not\u00e9s sous forme d\u2019\u00e9l\u00e9ments entre parenth\u00e8ses s\u00e9par\u00e9s par des virgules.<\/p>\n\n\n\n<figure class=\"wp-block-table\">\n<table style=\"width: 100%; height: 70px;\">\n<tbody>\n<tr style=\"height: 70px;\">\n<td style=\"height: 70px; padding-left: 40px;\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1915\" src=\"https:\/\/www.ardpylab.fr\/wp-content\/uploads\/2020\/04\/pythontuple1.png\" alt=\"\" width=\"213\" height=\"48\"><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/figure>\n\n\n\n<p>Les parenth\u00e8ses ne sont pas obligatoires&nbsp;:<\/p>\n\n\n\n<figure class=\"wp-block-table\">\n<table style=\"width: 100%; height: 70px;\">\n<tbody>\n<tr style=\"height: 70px;\">\n<td style=\"height: 70px; padding-left: 40px;\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1916\" src=\"https:\/\/www.ardpylab.fr\/wp-content\/uploads\/2020\/04\/pythontuple2.png\" alt=\"\" width=\"129\" height=\"45\"><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/figure>\n\n\n\n<p><br>Le tuple \u00e9tant une sorte de liste, on peut donc utiliser la m\u00eame syntaxe pour lire les donn\u00e9es du tuple.<\/p>\n\n\n\n<figure class=\"wp-block-table\">\n<table style=\"width: 100%; height: 70px;\">\n<tbody>\n<tr style=\"height: 70px;\">\n<td style=\"height: 70px; padding-left: 40px;\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1917\" src=\"https:\/\/www.ardpylab.fr\/wp-content\/uploads\/2020\/04\/pythontuple3.png\" alt=\"\" width=\"147\" height=\"45\"><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/figure>\n\n\n\n<p>Mais si on essaie de changer la valeur d&rsquo;un index, l&rsquo;interpr\u00e9teur affiche un message d\u2019erreur&nbsp;:<\/p>\n\n\n\n<figure class=\"wp-block-table\">\n<table style=\"width: 100%; height: 70px;\">\n<tbody>\n<tr style=\"height: 70px;\">\n<td style=\"height: 70px; padding-left: 40px;\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone  wp-image-1918\" src=\"https:\/\/www.ardpylab.fr\/wp-content\/uploads\/2020\/04\/pythontuple4-300x51.png\" alt=\"\" width=\"447\" height=\"76\" srcset=\"https:\/\/www.ardpylab.fr\/wp-content\/uploads\/2020\/04\/pythontuple4-300x51.png 300w, https:\/\/www.ardpylab.fr\/wp-content\/uploads\/2020\/04\/pythontuple4.png 471w\" sizes=\"auto, (max-width: 447px) 100vw, 447px\" \/><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/figure>\n\n\n\n<p>Cependant, le tuple permet une affectation multiple :<\/p>\n\n\n\n<figure class=\"wp-block-table\">\n<table style=\"width: 100%; height: 70px;\">\n<tbody>\n<tr style=\"height: 70px;\">\n<td style=\"height: 70px; padding-left: 40px;\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1919\" src=\"https:\/\/www.ardpylab.fr\/wp-content\/uploads\/2020\/04\/pythontuple5.png\" alt=\"\" width=\"145\" height=\"96\"><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/figure>\n\n\n\n<p style=\"padding-left: 40px;\">ou<\/p>\n\n\n\n<figure class=\"wp-block-table\">\n<table style=\"width: 100%; height: 70px;\">\n<tbody>\n<tr style=\"height: 70px;\">\n<td style=\"height: 70px; padding-left: 40px;\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1920\" src=\"https:\/\/www.ardpylab.fr\/wp-content\/uploads\/2020\/04\/pythontuple6.png\" alt=\"\" width=\"179\" height=\"49\"><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/figure>\n\n\n\n<p>Il sera donc principalement utilis\u00e9 pour d\u00e9finir les constantes des programmes.<\/p>\n<p>&nbsp;<\/p>\n\n\n<div  class=\"grids-section grids-is-stretch\" style=\"--_gs-gap-desktop:0px 0px;--_gs-m-desktop:0 0 0 0;--_gs-p-desktop:0 0 0 0;--_gs-bg-desktop:transparent none;--_gs-bg-xp-desktop:0px;--_gs-zi-desktop:auto;--_gs-d-desktop:block;--_gs-mw-desktop:calc(100% - 0 - 0);--_gs-gap-tablet:0px 0px;--_gs-m-tablet:0 0 0 0;--_gs-p-tablet:0 0 0 0;--_gs-bg-tablet:transparent none;--_gs-bg-xp-tablet:0px;--_gs-zi-tablet:auto;--_gs-d-tablet:block;--_gs-mw-tablet:calc(100% - 0 - 0);--_gs-gap-mobile:0px 0px;--_gs-m-mobile:0 0 0 0;--_gs-p-mobile:0 0 0 0;--_gs-bg-mobile:transparent none;--_gs-bg-xp-mobile:0px;--_gs-zi-mobile:auto;--_gs-d-mobile:block;--_gs-mw-mobile:calc(100% - 0 - 0);--_gs-columns:2;--_gs-rows:1\"><div class=\"grids-s-w_i\">\n<div class=\"grids-area\" style=\"--_ga-column:1\/2;--_ga-row:1\/2;--_ga-m-desktop:0 0 0 0;--_ga-p-desktop:0 0 0 0;--_ga-bg-desktop:transparent none;--_ga-zi-desktop:auto;--_ga-d-desktop:flex;--_ga-mw-desktop:calc(100% - 0 - 0);--_ga-m-tablet:0 0 0 0;--_ga-p-tablet:0 0 0 0;--_ga-bg-tablet:transparent none;--_ga-zi-tablet:auto;--_ga-d-tablet:flex;--_ga-mw-tablet:calc(100% - 0 - 0);--_ga-m-mobile:0 0 0 0;--_ga-p-mobile:0 0 0 0;--_ga-bg-mobile:transparent none;--_ga-zi-mobile:auto;--_ga-d-mobile:flex;--_ga-mw-mobile:calc(100% - 0 - 0)\">\n\n<div class=\"wp-block-image\"><figure class=\"alignleft size-large\"><a href=\"https:\/\/www.ardpylab.fr\/?page_id=1862\"><img loading=\"lazy\" decoding=\"async\" width=\"50\" height=\"28\" src=\"https:\/\/www.ardpylab.fr\/wp-content\/uploads\/2020\/03\/moins.jpg\" alt=\"\" class=\"wp-image-107\"\/><\/a><\/figure><\/div>\n\n<\/div>\n\n<div class=\"grids-area\" style=\"--_ga-column:2\/3;--_ga-row:1\/2;--_ga-m-desktop:0 0 0 0;--_ga-p-desktop:0 0 0 0;--_ga-bg-desktop:transparent none;--_ga-zi-desktop:auto;--_ga-d-desktop:flex;--_ga-mw-desktop:calc(100% - 0 - 0);--_ga-m-tablet:0 0 0 0;--_ga-p-tablet:0 0 0 0;--_ga-bg-tablet:transparent none;--_ga-zi-tablet:auto;--_ga-d-tablet:flex;--_ga-mw-tablet:calc(100% - 0 - 0);--_ga-m-mobile:0 0 0 0;--_ga-p-mobile:0 0 0 0;--_ga-bg-mobile:transparent none;--_ga-zi-mobile:auto;--_ga-d-mobile:flex;--_ga-mw-mobile:calc(100% - 0 - 0)\">\n\n<div class=\"wp-block-image\"><figure class=\"alignright size-large\"><a href=\"https:\/\/www.ardpylab.fr\/?page_id=1927\"><img loading=\"lazy\" decoding=\"async\" width=\"50\" height=\"28\" src=\"https:\/\/www.ardpylab.fr\/wp-content\/uploads\/2020\/03\/plus.jpg\" alt=\"\" class=\"wp-image-106\"\/><\/a><\/figure><\/div>\n\n<\/div>\n<\/div><\/div>","protected":false},"excerpt":{"rendered":"<p>Les tuples sont des listes qui ne peuvent pas \u00eatre modifi\u00e9es. Ils sont not\u00e9s sous forme d\u2019\u00e9l\u00e9ments entre parenth\u00e8ses s\u00e9par\u00e9s par des virgules. Les parenth\u00e8ses ne sont pas obligatoires&nbsp;: Le tuple \u00e9tant une sorte de liste, on peut donc utiliser la m\u00eame syntaxe pour lire les donn\u00e9es du tuple. Mais si on essaie de changer [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-1911","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/www.ardpylab.fr\/index.php?rest_route=\/wp\/v2\/pages\/1911","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.ardpylab.fr\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.ardpylab.fr\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.ardpylab.fr\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ardpylab.fr\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1911"}],"version-history":[{"count":0,"href":"https:\/\/www.ardpylab.fr\/index.php?rest_route=\/wp\/v2\/pages\/1911\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.ardpylab.fr\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1911"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}