{"id":3085,"date":"2026-03-03T08:22:19","date_gmt":"2026-03-03T07:22:19","guid":{"rendered":"https:\/\/labodemaths.fr\/WordPress3\/?p=3085"},"modified":"2026-03-05T17:03:16","modified_gmt":"2026-03-05T16:03:16","slug":"nsi-liste-de-liste-grilles-et-dessin","status":"publish","type":"post","link":"https:\/\/labodemaths.fr\/WordPress3\/nsi-liste-de-liste-grilles-et-dessin\/","title":{"rendered":"NSI, liste de liste, grilles et dessin"},"content":{"rendered":"\n<p>On consid\u00e8re le code python suivant<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>data = &#91;\n    &#91;0,0,0,0,0,1,1,1,1,0],\n    &#91;0,0,0,0,0,1,0,0,1,0],\n    &#91;0,0,1,0,1,0,1,1,0,0],\n    &#91;0,0,1,0,0,1,1,0,1,0],\n    &#91;0,0,1,0,1,0,0,1,1,0],\n    &#91;1,0,0,1,0,1,0,0,1,0],\n    &#91;0,1,0,0,0,1,1,1,1,1],\n    &#91;0,1,0,0,0,0,1,1,1,1],\n    &#91;1,0,0,0,1,1,1,0,1,0],\n    &#91;1,1,1,1,0,0,0,1,1,0]\n]\n\nimport matplotlib.pyplot as plt\n\nplt.imshow(data)\nplt.show()\n<\/code><\/pre>\n\n\n\n<p>Exercice 1 :<\/p>\n\n\n\n<p>Ecrire une fonction croix permettant d&rsquo;obtenir les r\u00e9sultats suivants<\/p>\n\n\n\n<p>&gt;&gt;&gt;croix(9)<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/labodemaths.fr\/WordPress3\/wp-content\/uploads\/2026\/03\/Capture-de\u0301cran-2026-03-03-a\u0300-08.26.39.png\"><img loading=\"lazy\" width=\"844\" height=\"838\" src=\"https:\/\/labodemaths.fr\/WordPress3\/wp-content\/uploads\/2026\/03\/Capture-de\u0301cran-2026-03-03-a\u0300-08.26.39.png\" alt=\"\" class=\"wp-image-3087\" srcset=\"https:\/\/labodemaths.fr\/WordPress3\/wp-content\/uploads\/2026\/03\/Capture-de\u0301cran-2026-03-03-a\u0300-08.26.39.png 844w, https:\/\/labodemaths.fr\/WordPress3\/wp-content\/uploads\/2026\/03\/Capture-de\u0301cran-2026-03-03-a\u0300-08.26.39-300x298.png 300w, https:\/\/labodemaths.fr\/WordPress3\/wp-content\/uploads\/2026\/03\/Capture-de\u0301cran-2026-03-03-a\u0300-08.26.39-150x150.png 150w, https:\/\/labodemaths.fr\/WordPress3\/wp-content\/uploads\/2026\/03\/Capture-de\u0301cran-2026-03-03-a\u0300-08.26.39-768x763.png 768w\" sizes=\"(max-width: 844px) 100vw, 844px\" \/><\/a><\/figure>\n\n\n\n<pre class=\"wp-block-code\"><code>&gt;&gt;&gt;croix(5)<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/labodemaths.fr\/WordPress3\/wp-content\/uploads\/2026\/03\/Capture-de\u0301cran-2026-03-03-a\u0300-08.26.17.png\"><img loading=\"lazy\" width=\"844\" height=\"838\" src=\"https:\/\/labodemaths.fr\/WordPress3\/wp-content\/uploads\/2026\/03\/Capture-de\u0301cran-2026-03-03-a\u0300-08.26.17.png\" alt=\"\" class=\"wp-image-3089\" srcset=\"https:\/\/labodemaths.fr\/WordPress3\/wp-content\/uploads\/2026\/03\/Capture-de\u0301cran-2026-03-03-a\u0300-08.26.17.png 844w, https:\/\/labodemaths.fr\/WordPress3\/wp-content\/uploads\/2026\/03\/Capture-de\u0301cran-2026-03-03-a\u0300-08.26.17-300x298.png 300w, https:\/\/labodemaths.fr\/WordPress3\/wp-content\/uploads\/2026\/03\/Capture-de\u0301cran-2026-03-03-a\u0300-08.26.17-150x150.png 150w, https:\/\/labodemaths.fr\/WordPress3\/wp-content\/uploads\/2026\/03\/Capture-de\u0301cran-2026-03-03-a\u0300-08.26.17-768x763.png 768w\" sizes=\"(max-width: 844px) 100vw, 844px\" \/><\/a><\/figure>\n\n\n\n<p>proposition de correction<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import matplotlib.pyplot as plt\r\n\r\ndef croix(n):\r\n    assert n%2==1,\"n doit etre impair\"\r\n    data=&#91;&#91;0 for i in range(n)] for j in range(n)]\r\n    for i in range(n):\r\n        data&#91;i]&#91;n\/\/2]=1\r\n        data&#91;n\/\/2]&#91;i]=1\r\n    plt.imshow(data)\r\n    plt.show()\r\n    \r\ndef diagonales(n): \r\n    data=&#91;&#91;0 for i in range(n)] for j in range(n)]\r\n    for i in range(n):\r\n        data&#91;i]&#91;i]=1\r\n        data&#91;i]&#91;n-1-i]=1\r\n    plt.imshow(data)\r\n    plt.show()\r\n    \r\ndef bords(n):\r\n    data=&#91;&#91;0 for i in range(n)] for j in range(n)]\r\n    for i in range(n):\r\n        data&#91;0]&#91;i]=1\r\n        data&#91;n-1]&#91;i]=1\r\n        data&#91;i]&#91;0]=1\r\n        data&#91;i]&#91;n-1]=1\r\n    plt.imshow(data)\r\n    plt.show()\r\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>On consid\u00e8re le code python suivant Exercice 1 : Ecrire une fonction croix permettant d&rsquo;obtenir&#8230;<\/p>\n<div class=\"more-link-wrapper\"><a class=\"more-link\" href=\"https:\/\/labodemaths.fr\/WordPress3\/nsi-liste-de-liste-grilles-et-dessin\/\">Read the post<span class=\"screen-reader-text\">NSI, liste de liste, grilles et dessin<\/span><\/a><\/div>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[57],"tags":[],"_links":{"self":[{"href":"https:\/\/labodemaths.fr\/WordPress3\/wp-json\/wp\/v2\/posts\/3085"}],"collection":[{"href":"https:\/\/labodemaths.fr\/WordPress3\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/labodemaths.fr\/WordPress3\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/labodemaths.fr\/WordPress3\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/labodemaths.fr\/WordPress3\/wp-json\/wp\/v2\/comments?post=3085"}],"version-history":[{"count":3,"href":"https:\/\/labodemaths.fr\/WordPress3\/wp-json\/wp\/v2\/posts\/3085\/revisions"}],"predecessor-version":[{"id":3091,"href":"https:\/\/labodemaths.fr\/WordPress3\/wp-json\/wp\/v2\/posts\/3085\/revisions\/3091"}],"wp:attachment":[{"href":"https:\/\/labodemaths.fr\/WordPress3\/wp-json\/wp\/v2\/media?parent=3085"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/labodemaths.fr\/WordPress3\/wp-json\/wp\/v2\/categories?post=3085"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/labodemaths.fr\/WordPress3\/wp-json\/wp\/v2\/tags?post=3085"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}