{"id":59,"date":"2021-11-22T17:43:27","date_gmt":"2021-11-22T16:43:27","guid":{"rendered":"http:\/\/yb-isn.fr\/2021\/nsi\/carla\/?p=59"},"modified":"2021-11-22T17:43:27","modified_gmt":"2021-11-22T16:43:27","slug":"exercices-liste","status":"publish","type":"post","link":"http:\/\/yb-isn.fr\/2021\/nsi\/carla\/?p=59","title":{"rendered":"Exercices : liste"},"content":{"rendered":"<p>Exercices retap\u00e9s, ex\u00e9cut\u00e9s et test\u00e9s dans <a href=\"https:\/\/geekflare.com\/fr\/online-compiler\/python\">Geekflare<\/a><\/p>\n<h2>Exercice 1<\/h2>\n<h3>Avec boucle for<\/h3>\n<p><code><br \/>\nlist_pair=[]<br \/>\nfor n in range(0,16):<br \/>\nif n%2==0:<br \/>\nlist_pair.append(n*2)<br \/>\nprint (list_pair)<\/code><\/p>\n<h3> Liste en compr\u00e9hension<\/h3>\n<p><code>list_pair=[n*2 for n in range(0,16) if n%2==0]<br \/>\nprint (list_pair)<\/code><\/p>\n<h2>Exercice 2<\/h2>\n<h3>Boucle for et condition<\/h3>\n<p><code>liste=[]<br \/>\nfor n in range(0,16):<br \/>\nif n%2==0:<br \/>\nliste.append(n*2)<br \/>\nelse :<br \/>\nliste.append(n*3)<br \/>\nprint (liste)<\/code><\/p>\n<h3> Liste en compr\u00e9hension avec condition<\/h3>\n<p><code><br \/>\nliste=[n*2 if n%2==0 else n*3 for n in range(0,16) ]<br \/>\nprint (liste) <\/code><\/p>\n<h2>Exercice 3<\/h2>\n<h3>Avec boucle for<\/h3>\n<p><code>list_7=[]<br \/>\nfor n in range (0,10):<br \/>\nlist_7.append(n*7)<br \/>\nprint (list_7)<\/code><\/p>\n<h3>Liste en compr\u00e9hension<\/h3>\n<p><code>list_7=[n*7 for n in range (0,10)]<br \/>\nprint (list_7)<br \/>\n<\/code><\/p>\n<h2>Exercice 4(2)<\/h2>\n<h3>Avec boucle for<\/h3>\n<p><code>lst=[]<br \/>\nfor i in range(0,100):<br \/>\nif i%7==0:<br \/>\nlst.append(i)<\/code><\/p>\n<p><code><br \/>\n<\/code><code>print (lst) <\/code><\/p>\n<h3>Liste en compr\u00e9hension<\/h3>\n<p><code><br \/>\nliste=[n for n in range(0,100) if n%7==0]<br \/>\nprint (liste) <\/code><\/p>\n<p>liste=[n*n for n in range(0,50) if n*n&lt;1000]<br \/>\nprint (liste)<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Exercices retap\u00e9s, ex\u00e9cut\u00e9s et test\u00e9s dans Geekflare Exercice 1 Avec boucle for list_pair=[] for n in range(0,16): if n%2==0: list_pair.append(n*2) print (list_pair) Liste en compr\u00e9hension list_pair=[n*2 for n in range(0,16) if n%2==0] print (list_pair) Exercice 2 Boucle for et condition liste=[] for n in range(0,16): if n%2==0: liste.append(n*2) else : liste.append(n*3) print (liste) Liste en&hellip; <a class=\"more-link\" href=\"http:\/\/yb-isn.fr\/2021\/nsi\/carla\/?p=59\">Poursuivre la lecture <span class=\"screen-reader-text\">Exercices : liste<\/span><\/a><\/p>\n","protected":false},"author":5,"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\/carla\/index.php?rest_route=\/wp\/v2\/posts\/59"}],"collection":[{"href":"http:\/\/yb-isn.fr\/2021\/nsi\/carla\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/yb-isn.fr\/2021\/nsi\/carla\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/yb-isn.fr\/2021\/nsi\/carla\/index.php?rest_route=\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"http:\/\/yb-isn.fr\/2021\/nsi\/carla\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=59"}],"version-history":[{"count":14,"href":"http:\/\/yb-isn.fr\/2021\/nsi\/carla\/index.php?rest_route=\/wp\/v2\/posts\/59\/revisions"}],"predecessor-version":[{"id":73,"href":"http:\/\/yb-isn.fr\/2021\/nsi\/carla\/index.php?rest_route=\/wp\/v2\/posts\/59\/revisions\/73"}],"wp:attachment":[{"href":"http:\/\/yb-isn.fr\/2021\/nsi\/carla\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=59"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/yb-isn.fr\/2021\/nsi\/carla\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=59"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/yb-isn.fr\/2021\/nsi\/carla\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=59"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}