{"id":1168,"date":"2022-02-07T17:43:58","date_gmt":"2022-02-07T16:43:58","guid":{"rendered":"http:\/\/yb-isn.fr\/2021\/nsi\/raphaelle\/?p=1168"},"modified":"2022-02-08T11:54:52","modified_gmt":"2022-02-08T10:54:52","slug":"collection-dobjets-en-python","status":"publish","type":"post","link":"http:\/\/yb-isn.fr\/2021\/nsi\/raphaelle\/2022\/02\/07\/collection-dobjets-en-python\/","title":{"rendered":"Collection d&rsquo;objets en Python \ud83d\ude00"},"content":{"rendered":"\n<p class=\"has-text-color has-background\" style=\"background-color:#7de2b9;color:#01a563\"><strong>I &#8211; Travail pr\u00e9liminaire : codez une fonction qui prend pour argument un jour de la semaine en anglais<\/strong><\/p>\n\n\n\n<p>La fonction doit renvoyer le jour de la semaine en fran\u00e7ais.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" width=\"649\" height=\"240\" src=\"http:\/\/yb-isn.fr\/2021\/nsi\/raphaelle\/wp-content\/uploads\/sites\/4\/2022\/02\/image-12.png\" alt=\"\" class=\"wp-image-1170\" srcset=\"http:\/\/yb-isn.fr\/2021\/nsi\/raphaelle\/wp-content\/uploads\/sites\/4\/2022\/02\/image-12.png 649w, http:\/\/yb-isn.fr\/2021\/nsi\/raphaelle\/wp-content\/uploads\/sites\/4\/2022\/02\/image-12-300x111.png 300w\" sizes=\"(max-width: 649px) 100vw, 649px\" \/><\/figure>\n\n\n\n<p>Lien Colab : <a href=\"https:\/\/colab.research.google.com\/drive\/1Lifs6t7S60crkJZq5GugcXAkSr1HzDjK\">https:\/\/colab.research.google.com\/drive\/1Lifs6t7S60crkJZq5GugcXAkSr1HzDjK<\/a><\/p>\n\n\n\n<p><strong>Correction :<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" width=\"657\" height=\"233\" src=\"http:\/\/yb-isn.fr\/2021\/nsi\/raphaelle\/wp-content\/uploads\/sites\/4\/2022\/02\/image-13.png\" alt=\"\" class=\"wp-image-1202\" srcset=\"http:\/\/yb-isn.fr\/2021\/nsi\/raphaelle\/wp-content\/uploads\/sites\/4\/2022\/02\/image-13.png 657w, http:\/\/yb-isn.fr\/2021\/nsi\/raphaelle\/wp-content\/uploads\/sites\/4\/2022\/02\/image-13-300x106.png 300w\" sizes=\"(max-width: 657px) 100vw, 657px\" \/><figcaption>&#8211;&gt; solution attendue<\/figcaption><\/figure>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" width=\"612\" height=\"180\" src=\"http:\/\/yb-isn.fr\/2021\/nsi\/raphaelle\/wp-content\/uploads\/sites\/4\/2022\/02\/image-15.png\" alt=\"\" class=\"wp-image-1209\" srcset=\"http:\/\/yb-isn.fr\/2021\/nsi\/raphaelle\/wp-content\/uploads\/sites\/4\/2022\/02\/image-15.png 612w, http:\/\/yb-isn.fr\/2021\/nsi\/raphaelle\/wp-content\/uploads\/sites\/4\/2022\/02\/image-15-300x88.png 300w\" sizes=\"(max-width: 612px) 100vw, 612px\" \/><figcaption>&#8211;&gt; autre solution attendue<\/figcaption><\/figure>\n\n\n\n<p> <\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-light-green-cyan-background-color has-text-color has-background\" style=\"color:#006e42\"><tbody><tr><td>collection d&rsquo;objets<\/td><td>modifiable ?<\/td><td>autorise les membres en double ?<\/td><td>index\u00e9e ?<\/td><td>avantages inconv\u00e9nients<\/td><\/tr><tr><td>liste<\/td><td>oui<\/td><td>oui<\/td><td>oui<\/td><td><\/td><\/tr><tr><td>tuple<\/td><td>non<\/td><td>oui<\/td><td>oui<\/td><td><\/td><\/tr><tr><td>dictionnaire<\/td><td>oui<\/td><td>non<\/td><td>non<\/td><td><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>Les&nbsp;<strong>listes<\/strong>, les&nbsp;<strong>dictionnaires<\/strong>&nbsp;et les&nbsp;<strong>tuples<\/strong>&nbsp;sont des objets qui peuvent contenir des collections d\u2019autres objets.<\/p>\n\n\n\n<p> <\/p>\n\n\n\n<p class=\"has-text-color has-background\" style=\"background-color:#92e2c2;color:#00ab67\"><strong>II &#8211; Les tuples<\/strong><\/p>\n\n\n\n<p>Pour comprendre les tuples : <a href=\"https:\/\/www.w3schools.com\/python\/python_tuples.asp\">https:\/\/www.w3schools.com\/python\/python_tuples.asp<\/a><\/p>\n\n\n\n<p>Les tuples sont utilis\u00e9s pour stocker plusieurs \u00e9l\u00e9ments dans une seule et unique variable.<\/p>\n\n\n\n<p>Un tuple est une &lsquo;collection&rsquo; qui est ordonn\u00e9e et <strong>non modifiable<\/strong>.<\/p>\n\n\n\n<p>Les tuples sont \u00e9crits avec des parenth\u00e8ses.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p class=\"has-text-color has-background\" style=\"background-color:#96e5c5;color:#00ae68\"><strong>III &#8211; Les dictionnaires<\/strong><\/p>\n\n\n\n<p>Pour comprendre les dictionnaires : <a href=\"https:\/\/www.w3schools.com\/python\/python_dictionaries.asp\">https:\/\/www.w3schools.com\/python\/python_dictionaries.asp<\/a><\/p>\n\n\n\n<p>Les dictionnaires sont utilis\u00e9s pour pour stocker des donn\u00e9es.<\/p>\n\n\n\n<p>Ils sont modifiables, mais n&rsquo;ont pas d&rsquo;indice.<\/p>\n\n\n\n<p>Les dictionnaires sont \u00e9crits avec des accolades ({}).<\/p>\n\n\n\n<p> <\/p>\n\n\n\n<p><\/p>\n\n\n\n<p class=\"has-text-color has-background\" style=\"background-color:#9cedcd;color:#02ac68\">I<strong>V &#8211; Les listes (rappels)<\/strong><\/p>\n\n\n\n<p>Pour comprendre (recomprendre) les listes Python : <a href=\"https:\/\/www.w3schools.com\/python\/python_lists.asp\">https:\/\/www.w3schools.com\/python\/python_lists.asp<\/a><\/p>\n\n\n\n<p>Les listes sont utilis\u00e9es pour stocker plusieurs \u00e9l\u00e9ments dans une seule et unique variable.<\/p>\n\n\n\n<p>Elles sont modifiables, et les valeurs ont des indices.<\/p>\n\n\n\n<p>Les listes sont \u00e9crites avec des crochets.<\/p>\n\n\n\n<p> <\/p>\n\n\n\n<p class=\"has-text-color has-background\" style=\"background-color:#a0e7ca;color:#02b76f\"><strong>V &#8211; Travail pr\u00e9liminaire avec les dictionnaires<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" width=\"224\" height=\"274\" src=\"http:\/\/yb-isn.fr\/2021\/nsi\/raphaelle\/wp-content\/uploads\/sites\/4\/2022\/02\/image-16.png\" alt=\"\" class=\"wp-image-1214\" \/><figcaption>\ud83d\udc4d<\/figcaption><\/figure>\n\n\n\n<p class=\"has-text-color has-background\" style=\"background-color:#9ad8ff;color:#0078c3\"><strong>VI &#8211; Autre programme<\/strong><\/p>\n\n\n\n<p>Lien Colab : <a href=\"https:\/\/colab.research.google.com\/drive\/1XZTZRIUdzMo72pBTOz1LonhjKvZg6qzr#scrollTo=k1YbBTOL6JJo\">https:\/\/colab.research.google.com\/drive\/1XZTZRIUdzMo72pBTOz1LonhjKvZg6qzr#scrollTo=k1YbBTOL6JJo<\/a><\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" width=\"193\" height=\"375\" src=\"http:\/\/yb-isn.fr\/2021\/nsi\/raphaelle\/wp-content\/uploads\/sites\/4\/2022\/02\/image-17.png\" alt=\"\" class=\"wp-image-1220\" srcset=\"http:\/\/yb-isn.fr\/2021\/nsi\/raphaelle\/wp-content\/uploads\/sites\/4\/2022\/02\/image-17.png 193w, http:\/\/yb-isn.fr\/2021\/nsi\/raphaelle\/wp-content\/uploads\/sites\/4\/2022\/02\/image-17-154x300.png 154w\" sizes=\"(max-width: 193px) 100vw, 193px\" \/><figcaption>programme1<\/figcaption><\/figure>\n\n\n\n<p> <\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" width=\"285\" height=\"176\" src=\"http:\/\/yb-isn.fr\/2021\/nsi\/raphaelle\/wp-content\/uploads\/sites\/4\/2022\/02\/image-18.png\" alt=\"\" class=\"wp-image-1222\" \/><figcaption>programme2<\/figcaption><\/figure>\n\n\n\n<p> <\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" width=\"286\" height=\"172\" src=\"http:\/\/yb-isn.fr\/2021\/nsi\/raphaelle\/wp-content\/uploads\/sites\/4\/2022\/02\/image-19.png\" alt=\"\" class=\"wp-image-1224\" \/><figcaption>programme2<\/figcaption><\/figure>\n\n\n\n<p> <\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" width=\"297\" height=\"200\" src=\"http:\/\/yb-isn.fr\/2021\/nsi\/raphaelle\/wp-content\/uploads\/sites\/4\/2022\/02\/image-20.png\" alt=\"\" class=\"wp-image-1226\" \/><figcaption>programme3<\/figcaption><\/figure>\n\n\n\n<p> <\/p>\n","protected":false},"excerpt":{"rendered":"<p>I &#8211; Travail pr\u00e9liminaire : codez une fonction qui prend pour argument un jour de la semaine en anglais La fonction doit renvoyer le jour de la semaine en fran\u00e7ais. Lien Colab : https:\/\/colab.research.google.com\/drive\/1Lifs6t7S60crkJZq5GugcXAkSr1HzDjK Correction : collection d&rsquo;objets modifiable ? autorise les membres en double ? index\u00e9e ? avantages inconv\u00e9nients liste oui oui oui tuple [&hellip;]<\/p>\n","protected":false},"author":4,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"_links":{"self":[{"href":"http:\/\/yb-isn.fr\/2021\/nsi\/raphaelle\/wp-json\/wp\/v2\/posts\/1168"}],"collection":[{"href":"http:\/\/yb-isn.fr\/2021\/nsi\/raphaelle\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/yb-isn.fr\/2021\/nsi\/raphaelle\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/yb-isn.fr\/2021\/nsi\/raphaelle\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"http:\/\/yb-isn.fr\/2021\/nsi\/raphaelle\/wp-json\/wp\/v2\/comments?post=1168"}],"version-history":[{"count":51,"href":"http:\/\/yb-isn.fr\/2021\/nsi\/raphaelle\/wp-json\/wp\/v2\/posts\/1168\/revisions"}],"predecessor-version":[{"id":1230,"href":"http:\/\/yb-isn.fr\/2021\/nsi\/raphaelle\/wp-json\/wp\/v2\/posts\/1168\/revisions\/1230"}],"wp:attachment":[{"href":"http:\/\/yb-isn.fr\/2021\/nsi\/raphaelle\/wp-json\/wp\/v2\/media?parent=1168"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/yb-isn.fr\/2021\/nsi\/raphaelle\/wp-json\/wp\/v2\/categories?post=1168"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/yb-isn.fr\/2021\/nsi\/raphaelle\/wp-json\/wp\/v2\/tags?post=1168"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}