From b4deb14e15ca77405ccc3236f98bb9ea1922b665 Mon Sep 17 00:00:00 2001
From: "quentin.fasler" <quentin.fasler@etu.hesge.ch>
Date: Mon, 6 Dec 2021 15:41:51 +0100
Subject: [PATCH] methode add

---
 polynomial.py | 21 ++++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)

diff --git a/polynomial.py b/polynomial.py
index 423cf0d..b1d8233 100644
--- a/polynomial.py
+++ b/polynomial.py
@@ -18,7 +18,26 @@ class Polynomial:
         pass
 
     def __add__(self, other):
-        pass
+        a = list(self.value)
+        b = list(other.value)
+    
+        a_count = len(a)
+        b_count = len(b)
+        if a_count > b_count:
+            diff = b_count-a_count
+            for x in range(diff):
+                b.append(0)
+        else:
+            diff = a_count-b_count
+            for x in range(diff):
+                a.append(0)
+                
+        c = [0] * a_count
+        for x in range(len(a)):
+            c[x] = a[x]+b[x]
+        
+        return Polynomial(tuple(c))
+        
 
     def __mul__(self, other):
         pass
-- 
GitLab