From eea1ca3faf174d695e56c1e01b1c0fdc8d40ad88 Mon Sep 17 00:00:00 2001 From: ACKERMANNGUE <gawen.ackermann@etu.hesge.ch> Date: Thu, 16 Dec 2021 10:47:10 +0100 Subject: [PATCH] rename func into evaluate_x --- polynomial.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/polynomial.py b/polynomial.py index c2ccbb8..0a360c2 100644 --- a/polynomial.py +++ b/polynomial.py @@ -32,7 +32,7 @@ class Polynomial: raise TypeError('The "value" parameter is not of type tuple.') self.value = value - def pass_x_throughout(self, x): + def evaluate_x(self, x): """Evaluate the polynomial by passing x Args: @@ -229,7 +229,7 @@ def reed_solomon(points, data_length, last_error_index, prime_number): for p in points: x = p[0] # Pass the x value of each points through the lagrange polynomial - y = lagrange.pass_x_throughout(x) % prime_number + y = lagrange.evaluate_x(x) % prime_number # If the result is the same that the y value, then the point is correct if y == p[1]: nb_valid_points += 1 @@ -239,7 +239,7 @@ def reed_solomon(points, data_length, last_error_index, prime_number): # Decode the message output = "" for i in range(data_length): - output += chr(lagrange.pass_x_throughout(i) % prime_number) + output += chr(lagrange.evaluate_x(i) % prime_number) return output -- GitLab