From 8248796a6486a0c0071be796d76e33532c932ca6 Mon Sep 17 00:00:00 2001 From: Geoffrey Frogeye Date: Tue, 10 Mar 2015 10:50:42 +0100 Subject: [PATCH 1/3] =?UTF-8?q?TP4=20Oubli=C3=A9=20partie(),=20section()?= =?UTF-8?q?=20et=20question()?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- S2/TP4/analyse_tris.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/S2/TP4/analyse_tris.py b/S2/TP4/analyse_tris.py index 5de82cd..a2e9e07 100644 --- a/S2/TP4/analyse_tris.py +++ b/S2/TP4/analyse_tris.py @@ -17,6 +17,19 @@ http://www.fil.univ-lille1.fr/~L1S2API/CoursTP/tp4_tri.html __author__ = 'PREUD\'HOMME Geoffrey & BEAUSSART Jean-loup' __date_creation__ = 'Tue, 10 Mar 2015 10:26:41 +0100' +from random import randint, shuffle + +def partie(nom): + print('\n', nom, '=' * len(nom), sep='\n') + + +def section(nom): + print('\n', nom, '-' * len(nom), sep='\n') + + +def question(numero): + print('\n***', 'Question', numero, '***') + partie("Prérequis") partie("Travail à réaliser") From 1b00b308cc82d74d8073d4970beedccd162aac63 Mon Sep 17 00:00:00 2001 From: Geoffrey Frogeye Date: Tue, 10 Mar 2015 10:52:14 +0100 Subject: [PATCH 2/3] TP4 liste_alea() --- S2/TP4/analyse_tris.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/S2/TP4/analyse_tris.py b/S2/TP4/analyse_tris.py index a2e9e07..3f09a4d 100644 --- a/S2/TP4/analyse_tris.py +++ b/S2/TP4/analyse_tris.py @@ -36,6 +36,16 @@ partie("Travail à réaliser") section("Préliminaires") +def liste_alea(n, a, b): + """ + int, int, int → list + """ + res = [] + for i in range(n): + res.append(randint(a, b)) + return res + + question(0) question(0) From b66e0c339381046f6ca5448da4bbfd4347c78616 Mon Sep 17 00:00:00 2001 From: Geoffrey Frogeye Date: Tue, 10 Mar 2015 10:54:12 +0100 Subject: [PATCH 3/3] liste_alea() docstring --- S2/TP4/analyse_tris.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/S2/TP4/analyse_tris.py b/S2/TP4/analyse_tris.py index 3f09a4d..ece913f 100644 --- a/S2/TP4/analyse_tris.py +++ b/S2/TP4/analyse_tris.py @@ -39,6 +39,8 @@ section("Préliminaires") def liste_alea(n, a, b): """ int, int, int → list + Renvoie une liste d’entiers, qui construit une liste de longueur n les entiers choisis au hasard + compris entre a et b. """ res = [] for i in range(n):