From 6d9ac2c5f5aeeae0bfe23eff3d612c47d70954fe Mon Sep 17 00:00:00 2001 From: Louis Chmielewski <louis.chmielewski@icloud.com> Date: Wed, 27 Mar 2024 09:05:52 +0100 Subject: [PATCH] compare class Card --- Tp08/card.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Tp08/card.py b/Tp08/card.py index 53d3dfa..94d1b1a 100755 --- a/Tp08/card.py +++ b/Tp08/card.py @@ -98,7 +98,13 @@ class Card(object): $$$ c1.compare(c3) == 0 True """ - ... + if Card.VALUES.index(self.value) > Card.VALUES.index(card.value): + res = 1 + elif Card.VALUES.index(self.value) < Card.VALUES.index(card.value): + res = -1 + else: + res = 0 + return res @staticmethod def deck(n_card: int) -> list[Card]: -- GitLab