From 0cd68792905cb004e55731e89d1174e067d5b5c3 Mon Sep 17 00:00:00 2001 From: Aissi Jude Christ Date: Wed, 15 Oct 2025 12:59:56 +0200 Subject: [PATCH] =?UTF-8?q?Exo=203=20=C3=A0=20finir?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Exercice2.md | 16 ++++++++++++++++ Exercice3.md | 0 fonctions.py | 29 +++++++++++++++++++++++++++++ 3 files changed, 45 insertions(+) create mode 100644 Exercice2.md create mode 100644 Exercice3.md create mode 100644 fonctions.py diff --git a/Exercice2.md b/Exercice2.md new file mode 100644 index 0000000..1f30717 --- /dev/null +++ b/Exercice2.md @@ -0,0 +1,16 @@ +**Calculs de complecité de fonctions** + +- Function_1 + - Complexité = 1 + - O(n×m) + + +- Function_2 + - Complexité = 1 + - O(n) + +- Function_3 + - Complexité = 1 + - O(n) + + diff --git a/Exercice3.md b/Exercice3.md new file mode 100644 index 0000000..e69de29 diff --git a/fonctions.py b/fonctions.py new file mode 100644 index 0000000..668c343 --- /dev/null +++ b/fonctions.py @@ -0,0 +1,29 @@ +def function(tableau1, tableau2): + presentDansDeuxListes = 0 + for nombre1 in tableau1: + for (nombre2 in tableau2): + if (nombre1 == nombre2): + presentDansDeuxListes += 1 + break + return presentDansDeuxListes + + +def funtion_2(x): + valeur = 0 + while (x > 0): + valeur = valeur + x + x -= 1 + return valeur + + +def function_3(x): + valeur = 0 + + if (x < 0): + valeur = -x + if (x == 0): + pass + if (x > 0): + valeur = x + return valeur +