{"id":25,"date":"2021-09-20T17:03:58","date_gmt":"2021-09-20T15:03:58","guid":{"rendered":"http:\/\/yb-isn.fr\/2021\/nsi\/lukas\/?p=25"},"modified":"2021-09-27T17:31:40","modified_gmt":"2021-09-27T15:31:40","slug":"les-fonctions-python","status":"publish","type":"post","link":"http:\/\/yb-isn.fr\/2021\/nsi\/lukas\/?p=25","title":{"rendered":"Les Fonctions (Python)."},"content":{"rendered":"\n<p>Une fonction est une suite d&rsquo;instructions que l&rsquo;on peut appeler avec un nom.<\/p>\n\n\n\n<p><strong><em>Une fonction se pr\u00e9sente sous cette forme <\/em><\/strong>:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" width=\"423\" height=\"73\" src=\"http:\/\/yb-isn.fr\/2021\/nsi\/lukas\/wp-content\/uploads\/sites\/16\/2021\/09\/image-2.png\" alt=\"\" class=\"wp-image-26\" srcset=\"http:\/\/yb-isn.fr\/2021\/nsi\/lukas\/wp-content\/uploads\/sites\/16\/2021\/09\/image-2.png 423w, http:\/\/yb-isn.fr\/2021\/nsi\/lukas\/wp-content\/uploads\/sites\/16\/2021\/09\/image-2-300x52.png 300w\" sizes=\"(max-width: 423px) 100vw, 423px\" \/><figcaption>Exemple.<\/figcaption><\/figure>\n\n\n\n<p><strong><em>Voici plusieurs exemple de fonctions :<\/em><\/strong><\/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=\"\">#la valeur absolue d'un nombre se traduit par : si x&gt;0, alors valeur absolue de x = x \n#et si x&lt;0, alors valeur absolue de x = -x\ndef valeurabsolue(x):\n    if x&gt;0:\n        return x\n    if x&lt;0:\n        return -x\n    else:\n        return x<\/pre>\n\n\n\n<p>La fonction ci-dessus permet de calculer la valeur absolue d&rsquo;un nombre.<\/p>\n\n\n\n<p>La fonction ci-dessous permet de calculer l&rsquo;intensit\u00e9 du champ de pesanteur au dessus d&rsquo;une plan\u00e8te. \u00ab\u00a0M\u00a0\u00bb signifie la masse de la plan\u00e8te, \u00ab\u00a0r\u00a0\u00bb signifie le rayon de la plan\u00e8te et \u00ab\u00a0h\u00a0\u00bb repr\u00e9sente l&rsquo;altitude.<\/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=\"\">G=6.67E-11\ndef pesanteur(M,h,r):\n    g=G*M\/(r+h)**2\n    return g<\/pre>\n\n\n\n<p><strong><em>Voici la correction  de la fonction sur la Fonction de la pesanteur.<\/em><\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" width=\"619\" height=\"564\" src=\"http:\/\/yb-isn.fr\/2021\/nsi\/lukas\/wp-content\/uploads\/sites\/16\/2021\/09\/image-10.png\" alt=\"\" class=\"wp-image-63\" srcset=\"http:\/\/yb-isn.fr\/2021\/nsi\/lukas\/wp-content\/uploads\/sites\/16\/2021\/09\/image-10.png 619w, http:\/\/yb-isn.fr\/2021\/nsi\/lukas\/wp-content\/uploads\/sites\/16\/2021\/09\/image-10-300x273.png 300w\" sizes=\"(max-width: 619px) 100vw, 619px\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n\n\n\n<p class=\"has-extra-large-font-size\"><span style=\"color:#f27b95\" class=\"has-inline-color\"><strong><em>Cliquez sur ce lien pour voir toutes les corrections<\/em><\/strong> :<\/span> <a href=\"https:\/\/colab.research.google.com\/drive\/1oiNiQzRYH08Dc6N2jJbzbCSIP0NkwaYw?usp=sharing\" data-type=\"URL\" data-id=\"https:\/\/colab.research.google.com\/drive\/1oiNiQzRYH08Dc6N2jJbzbCSIP0NkwaYw?usp=sharing\">https:\/\/colab.research.google.com\/drive\/1oiNiQzRYH08Dc6N2jJbzbCSIP0NkwaYw?usp=sharing<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Une fonction est une suite d&rsquo;instructions que l&rsquo;on peut appeler avec un nom. Une fonction se pr\u00e9sente sous cette forme : Voici plusieurs exemple de fonctions : La fonction ci-dessus permet de calculer la valeur absolue d&rsquo;un nombre. La fonction ci-dessous permet de calculer l&rsquo;intensit\u00e9 du champ de pesanteur au dessus d&rsquo;une plan\u00e8te. \u00ab\u00a0M\u00a0\u00bb signifie [&hellip;]<\/p>\n","protected":false},"author":16,"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\/lukas\/index.php?rest_route=\/wp\/v2\/posts\/25"}],"collection":[{"href":"http:\/\/yb-isn.fr\/2021\/nsi\/lukas\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/yb-isn.fr\/2021\/nsi\/lukas\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/yb-isn.fr\/2021\/nsi\/lukas\/index.php?rest_route=\/wp\/v2\/users\/16"}],"replies":[{"embeddable":true,"href":"http:\/\/yb-isn.fr\/2021\/nsi\/lukas\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=25"}],"version-history":[{"count":9,"href":"http:\/\/yb-isn.fr\/2021\/nsi\/lukas\/index.php?rest_route=\/wp\/v2\/posts\/25\/revisions"}],"predecessor-version":[{"id":64,"href":"http:\/\/yb-isn.fr\/2021\/nsi\/lukas\/index.php?rest_route=\/wp\/v2\/posts\/25\/revisions\/64"}],"wp:attachment":[{"href":"http:\/\/yb-isn.fr\/2021\/nsi\/lukas\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=25"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/yb-isn.fr\/2021\/nsi\/lukas\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=25"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/yb-isn.fr\/2021\/nsi\/lukas\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=25"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}