From 57b40c46830d85e7baa6db3d733850ddbf8b8661 Mon Sep 17 00:00:00 2001 From: Raito Bezarius Date: Wed, 17 Jun 2020 18:33:12 +0200 Subject: [PATCH] cours: exercice 1 --- illustrations/1_tester/test_unitaire.py | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/illustrations/1_tester/test_unitaire.py b/illustrations/1_tester/test_unitaire.py index 3a0ff33..4cba9b5 100644 --- a/illustrations/1_tester/test_unitaire.py +++ b/illustrations/1_tester/test_unitaire.py @@ -5,11 +5,22 @@ def est_premier(n): >>> est_premier(5) True >>> est_premier(4) - True + False """ - for k in range(n): - if k % n == 0: + for k in range(2, n): + if n % k == 0: return False return True +# Exercice: Soit S un string +# S = mot_1 mot_2 … mot_n +# renvoyez miroir(mot_1) … miroir(mot_n) +def reverse_words(S): + """ + >>> reverse_words("abc def") + cba fed + >>> reverse_words("bonjour bonsoir") + roujnob riosnob + """ + pass