From 6d3b69a33e285cdb19348330254d8d7ec393d1de Mon Sep 17 00:00:00 2001 From: "quentin.fasler" <quentin.fasler@etu.hesge.ch> Date: Tue, 7 Dec 2021 09:50:22 +0100 Subject: [PATCH] correction de la methode mod (suppresion des 0) --- polynomial.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/polynomial.py b/polynomial.py index 117af5a..ef82cc0 100644 --- a/polynomial.py +++ b/polynomial.py @@ -60,6 +60,12 @@ class Polynomial: for i in range(len(a)): result[i] = a[i] % other + for i in reversed(range(len(result))): + if result[i] ==0: + del result[i] + else: + break + return Polynomial(tuple(result)) def __str__(self): -- GitLab