def decode(self, encoded_data): extrapolated_poly = Polynomial.regress(self.x_coords, encoded_data, self.degree) extrapolated_y = [] # zero_corrector = extrapolated_poly.value_at(degree) zero_corrector = 0 for x in range(self.degree): y = extrapolated_poly.value_at(x) - zero_corrector extrapolated_y.append(y) return extrapolated_y