From 319bcc46d7e8df407839bfd29ac19708cb465032 Mon Sep 17 00:00:00 2001 From: Tipragot Date: Thu, 14 Dec 2023 14:25:08 +0100 Subject: [PATCH] 3 --- Chapitre 4 - Graphes/C08_activite_reseau.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Chapitre 4 - Graphes/C08_activite_reseau.py b/Chapitre 4 - Graphes/C08_activite_reseau.py index 7fc3c2f..609aea1 100644 --- a/Chapitre 4 - Graphes/C08_activite_reseau.py +++ b/Chapitre 4 - Graphes/C08_activite_reseau.py @@ -83,4 +83,9 @@ def plus_ancienne_relation(personnes): gens = (p1, p2) return gens -print(plus_ancienne_relation(exemple_reseau.values())) \ No newline at end of file +print(plus_ancienne_relation(exemple_reseau.values())) + +def plus_de_relations(personnes): + return max(personnes, key=lambda p: len(p.relations)) + +print(plus_de_relations(exemple_reseau.values())) \ No newline at end of file