From 4be4bb45bd16836349aa901848f99e37885e4a6a Mon Sep 17 00:00:00 2001 From: Arthur Jacquin <arthur.jacquin@student-cs.fr> Date: Thu, 13 Oct 2022 19:02:40 +0200 Subject: [PATCH] Add modulo --- calculator/operators.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/calculator/operators.py b/calculator/operators.py index 8da0d85..58e5004 100644 --- a/calculator/operators.py +++ b/calculator/operators.py @@ -1,6 +1,8 @@ """ Operator module contains the Operator class and a list of standard operators. """ + + class Operator: """ Operator class is a binary operator with a symbol, a precedence and an evaluation function. @@ -21,6 +23,7 @@ class Operator: STANDARD_OPERATORS = { '+': Operator('+', 1, lambda a, b: a + b), '-': Operator('-', 1, lambda a, b: a - b), - '*': Operator('×', 2, lambda a, b: a * b), + '*': Operator('*', 2, lambda a, b: a * b), '/': Operator('/', 2, lambda a, b: a / b), + '%': Operator('%', 2, lambda a, b: a % b), } -- GitLab