Skip to content
Snippets Groups Projects
Commit b4deb14e authored by quentin.fasler's avatar quentin.fasler
Browse files

methode add

parent 153b6738
Branches
No related tags found
No related merge requests found
...@@ -18,7 +18,26 @@ class Polynomial: ...@@ -18,7 +18,26 @@ class Polynomial:
pass pass
def __add__(self, other): 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): def __mul__(self, other):
pass pass
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment