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

add modulo

parent 610cb0bc
Branches
No related tags found
No related merge requests found
......@@ -54,7 +54,13 @@ class Polynomial:
return Polynomial(tuple(c))
def __mod__(self, other):
pass
a = list(self.value)
result = [0] * len(a)
for i in range(len(a)):
result[i] = a[i] % other
return Polynomial(tuple(result))
def __str__(self):
str_value = ""
......@@ -90,6 +96,8 @@ def main():
print(p1)
print(p2)
print(p3)
print(p3%4)
print(p3%5)
with open("messages.json") as f:
messages = json.load(f)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment