Fusion de deux listes triées⚓︎
Exercice conseillé en version À compléter
- Les exercices conseillés en version "Vide" sont conçus pour ressembler à un "exercice 1" des épreuves pratiques au baccalauréat de Terminale NSI.
- Les exercices conseillés en version "À compléter" sont conçus pour ressembler à un "exercice 2" des épreuves pratiques au baccalauréat de Terminale NSI.
La difficulté de l'exercice a été choisie en partant du principe qu'il est fait dans la version indiquée.
On souhaite écrire le code de la fonction fusion
qui prend en paramètres deux listes d'entiers liste_a
, liste_b
triées par ordre croissant et les fusionne en une seule liste triée liste_triee
qu'elle renvoie.
Contrainte
On interdit d'utiliser les fonctions de tri natives sort
et sorted
.
Exemples
>>> fusion([1, 6, 10], [0, 7, 8, 9])
[0, 1, 6, 7, 8, 9, 10]
>>> fusion([1, 6, 10], [])
[1, 6, 10]
>>> fusion([], [0, 7, 8, 9])
[0, 7, 8, 9]
Tronquer ou non le feedback dans les terminaux (sortie standard & stacktrace / relancer le code pour appliquer)
Si activé, le texte copié dans le terminal est joint sur une seule ligne avant d'être copié dans le presse-papier
.128013.128073lS]et-dA5f18umaèg,_/R=in
6)yàqPhcDL[(bEsx.p;r4jC'90"ov+w73êOk:é 2I030c090a0k0s060J0*0C060k0J0J0r0V0a0s0M0V020u030J0i0j0j0k0O0x02070W060i100W0t0*000k0j0M0N0*0q091a0O0z0i090J030p17191b1d150M02031I1B1L0p1I150c0s0X0^0`0|0~0B0s0m0B061Z0B0a13030:0H06091U0{0}0V1Y1!1$1!0a1+1-1)0a0O1J0a0B0^1g0J0M0k0t0~0+0V1/1W0V0f0=090t1o091)25272c1;2f1-2i0j2k02040*0A0O0W0M0W0J0s1j1l0.230O0O090C2F1B2m0t1J0p212R1~201 1*0c2o0~1$0t2h2C1)1R1T0_1:2#0s2%0t0W2*1)0M2K1J2P2R2{16261l2,2d2;0O1a06130*0g2O2 142~2n311;3335370+3a273c2P2!0V3h0k36020*0#3l2Q153o3f0~3r3t0*0P3x3n2 3p3D370e3H3z3J3B3q0W343s370v3O3d301V3g3T3i3u0!3Y3A3#3C3%3V3u0h3*3Q3,3S3U3E0T3=3e3@3L020g0U3|3!2-3^3'0g391C3b3P3}453 0g3k4a3m4c44323.3t0g3w4i3y3Z3K4n130g3G4r3I4d4m3_4w3N4z4k4u4D403X4G4t3R4f3)4M3+4e4v403;4R3?4T4J0g3{4X4B3$4J0+424z1M2_1B2*2U0c202Z3R0C2=2u0-1S1J2^092`3b3H034_0.514'0~0'130.0f3H0*4N3~0f130f0i2D1k534S2d12020G5o4Y32131$0J0a090o0k5u580V5r0n5e5g4e5x0s5z5B0H5E4l1;5r0w0(3O0*5Y5f5p3g130:0=1-5C5J5#0~0W130r5+5v3g0H5x2h5R3p5r5t4,5,3q5M5O5*5~5=0~5U5X5Z5K5w025'065)5Q4z5!650V5.025:6h6a5?5^0t5`3R5|6t3~615A0o6g2}5 674G5Z6i5F0t6y5B1~0s09095;5F6l6n2{6H5S66130F08685Y6p3C130s636U6%6k5/6Q6W0V0j0s134+2{0u6G6,6J026)6B3b6V3p6S6/3p6=6@6#723R5a020Z1Y1-756u135}6C6j6}6)5D6o5 6l00060a0N7h6x6c0;6e5B7p7l5F6E6+7r0Z13270c7x456v646I6(6A7N2d7s7u7w7q7m5%7A6f6w7O135V796{5 7c0s5d7Z7R025y6z7D526D6Y7'6b7o7}5T136!7;6:7W7v7U5$7?5N6z703m6,5r0F806'6~7T7Q6:5r085W6F6G8s6$5 6}7@6L0O6N6P8m73130L8i60020k0M0M2h7M8C7i5s8G8w8b7C8G8g8R7S7_8e7{02080w7+8t7a7y7 848D020Y6T716,77408(8u6j7c090?8B7E8n138q6_8)8s6|6K0o6M6O8G6l8F8O7y8J8L0t8N905{7j8X8a628d2Q8f7|9f5L8k9r57918$8'8r958`7=6 885-138:9I6;6?8^9D8*457c7e2g9M7n6*8=7r137t878-4O7#5(8U9v5q928_9R6b8x998z9b9,1;9d9o9h8M8V9n9_8j9=8Z9s8#8ha18H8,9l8P8%9/978ka43u6,6l9L9'3@8@4994697-139U7gam9w9Haw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0t0mc9c5aIg9cu7=f;d0f@0Y9og1f,aeas6~fPgvf#cdcFf@chgRg*gT7KcBfQ8PcPg(cR9xgHcgc;0Ngxg36}g/dk0Wczfgf)98g+cv9udr8YaYgLg^3@86hcgRgcaYa(gaa*gdho9Bf-149EgDh7gF9^doaThq8I8K9~g8fZh63KhmhA9og`a5hFad9QaM8vhrhha_9Ma~h(hK3p8|8~aYhH6`hJhe98aP9c8E9|hSh2hC9-hVh$gEcshEa-a'h!dfg$7(9B9/ghh7gug{cfalh3an9Oapgr9F6:b10/b4fWimi862h~4MdwbhfH4/4}0u0%1le)0QdV1.bWdZ1-b40*f32i0tb;2HeR56f}iF3u2DbL1M3cf83c1$020I7Bd}d e60*ebeddU0:1-2tiYek0Oem0O1y0*5tc'3@c)fpif7~gjg3hwg~gjfh569Ci/15jmer0/bXe%f6eJd+d.239j2Eb#0te75ziV0)8z2fb*i*bO15i-jn0s7?dQd|i#50hzi'exi_ec0*i|d!i b;26j2b_j41.j7d9c(dbjbdeg2dh00hbhdg0iejj50jljOjNjPiVd!iUj3eZeI1.jSf$9+eVdC0*2/0fjF6Nb41.0y0^8}f90.h`6$cXjUeVj,2Hj.fo1_fqhLc hZa!c.hUhtiA85cHhxhlkaj{a6idia9AkH9si'j~3c0pjM1BjokY06e=bTjBjZb_dX0@d_e40@0C0{b,0=0*bA1idR8Md{dQiSd#0O23b4k6d+fdjTi9j|02e;15bi0/7A0J02.
###(Dés-)Active le code après la ligne
(Ctrl+I)
# Tests
(insensible à la casse)(Ctrl+I)
Tronquer ou non le feedback dans les terminaux (sortie standard & stacktrace / relancer le code pour appliquer)
Si activé, le texte copié dans le terminal est joint sur une seule ligne avant d'être copié dans le presse-papier
.128013.128073lS]et-dA5f18umaèg,_/R=in
6)yàqPhcDL[(bEsx.p;r4jC'90"ov+w73êOk:é 2I030c090a0k0s060J0*0C060k0J0J0r0V0a0s0M0V020u030J0i0j0j0k0O0x02070W060i100W0t0*000k0j0M0N0*0q091a0O0z0i090J030p17191b1d150M02031I1B1L0p1I150c0s0X0^0`0|0~0B0s0m0B061Z0B0a13030:0H06091U0{0}0V1Y1!1$1!0a1+1-1)0a0O1J0a0B0^1g0J0M0k0t0~0+0V1/1W0V0f0=090t1o091)25272c1;2f1-2i0j2k02040*0A0O0W0M0W0J0s1j1l0.230O0O090C2F1B2m0t1J0p212R1~201 1*0c2o0~1$0t2h2C1)1R1T0_1:2#0s2%0t0W2*1)0M2K1J2P2R2{16261l2,2d2;0O1a06130*0g2O2 142~2n311;3335370+3a273c2P2!0V3h0k36020*0#3l2Q153o3f0~3r3t0*0P3x3n2 3p3D370e3H3z3J3B3q0W343s370v3O3d301V3g3T3i3u0!3Y3A3#3C3%3V3u0h3*3Q3,3S3U3E0T3=3e3@3L020g0U3|3!2-3^3'0g391C3b3P3}453 0g3k4a3m4c44323.3t0g3w4i3y3Z3K4n130g3G4r3I4d4m3_4w3N4z4k4u4D403X4G4t3R4f3)4M3+4e4v403;4R3?4T4J0g3{4X4B3$4J0+424z1M2_1B2*2U0c202Z3R0C2=2u0-1S1J2^092`3b3H034_0.514'0~0'130.0f3H0*4N3~0f130f0i2D1k534S2d12020G5o4Y32131$0J0a090o0k5u580V5r0n5e5g4e5x0s5z5B0H5E4l1;5r0w0(3O0*5Y5f5p3g130:0=1-5C5J5#0~0W130r5+5v3g0H5x2h5R3p5r5t4,5,3q5M5O5*5~5=0~5U5X5Z5K5w025'065)5Q4z5!650V5.025:6h6a5?5^0t5`3R5|6t3~615A0o6g2}5 674G5Z6i5F0t6y5B1~0s09095;5F6l6n2{6H5S66130F08685Y6p3C130s636U6%6k5/6Q6W0V0j0s134+2{0u6G6,6J026)6B3b6V3p6S6/3p6=6@6#723R5a020Z1Y1-756u135}6C6j6}6)5D6o5 6l00060a0N7h6x6c0;6e5B7p7l5F6E6+7r0Z13270c7x456v646I6(6A7N2d7s7u7w7q7m5%7A6f6w7O135V796{5 7c0s5d7Z7R025y6z7D526D6Y7'6b7o7}5T136!7;6:7W7v7U5$7?5N6z703m6,5r0F806'6~7T7Q6:5r085W6F6G8s6$5 6}7@6L0O6N6P8m73130L8i60020k0M0M2h7M8C7i5s8G8w8b7C8G8g8R7S7_8e7{02080w7+8t7a7y7 848D020Y6T716,77408(8u6j7c090?8B7E8n138q6_8)8s6|6K0o6M6O8G6l8F8O7y8J8L0t8N905{7j8X8a628d2Q8f7|9f5L8k9r57918$8'8r958`7=6 885-138:9I6;6?8^9D8*457c7e2g9M7n6*8=7r137t878-4O7#5(8U9v5q928_9R6b8x998z9b9,1;9d9o9h8M8V9n9_8j9=8Z9s8#8ha18H8,9l8P8%9/978ka43u6,6l9L9'3@8@4994697-139U7gam9w9Haw7V9#7X9W9)7B8lab3@5r934b95af9=9a8 7`6j9{a86}9}9j9 8QaU989y9t02a7aHaxaGaR7F829Caq8tafay7HaS9K8;3m9:1;ao796,7c2K0a0i0O6saz89aO9@aQ4j1B55504-bf0p4:1B0a4=bk2X2S0k1,bh4:1H9z3p2K0j0o0f0k0'5B0B0#131t1v1x1z0*aK8e1O3c1I050*0D270@0`0*0J1g1i0s1k0*2^2A2C0)090n0*b$bY0O0a0*2HbW0H0W0i0_1.0(15be3p1?1#1%1(bv7bat7fbb2Qa|8jaa9Za^029$7Ya@6I5@7?5_a87Pa)9;8T9Y8!6j7Gce6R7J8IaXb7cca+a{ajaB9%cj6:0tcl2raY7ka,cKa#aY7*4,0pbe14063T0JbJ5fb 3Rc11^1'2l7!ag9M7s0mcIcxcKcMcncq81aZc`a2csaha%a/52cW4`3ub_c%4`c01%c*c4a=cEcacGcgaCcC3qc^b6c}5Ga0do8S9qcT53d4560L0*0R0S1z0a0b0y0b1R2K0*cZ0Oc#0i0Sb$0kb%8z0@0ab_5AbVbK0X3s09b40@0c0S0i2%b=bK0.0i0KdJ8T0Jdy0E0S0k1idI8x0*0td^b%d#dD0$1~1.260@2h4_dI0)0a0)0*2h100lbxefb%1b4_b41y9e1P1K020,060*0x0*dQ0c1k0Cex0ib%1h0@d)1.0.d%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