From ab64d0fe7f715bca02ed1ccfd054738104eae8af Mon Sep 17 00:00:00 2001 From: Manon Date: Mon, 27 Jan 2025 11:17:35 +0100 Subject: [PATCH] et --- projet_calculatrice.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/projet_calculatrice.py b/projet_calculatrice.py index 9c3e2fe..b9baa2e 100644 --- a/projet_calculatrice.py +++ b/projet_calculatrice.py @@ -11,10 +11,10 @@ class Expression : def évalue (self): if self.valeur == '*': - return multiplication(fils_gauche, fils_droit) + return multiplication(valeur.gauche, valeur.droit) if self.valeur == '+': - return addition(fils_gauche, fils_droit) + return addition(valeur.gauche, valeur.droit) else : pass @@ -23,3 +23,14 @@ class Expression : def __str__ : #affichage en dfs infixe +def multiplication (valeur.gauche, valeur.droit): + if valeur.gauche == int and valeur.droit == int : + return valeur.gauche * valeur.droit + + +def addition (valeur.gauche, valeur.droit): + if valeur.gauche == int and valeur.droit == int : + return valeur.gauche + valeur.droit + + + \ No newline at end of file