From a6b6f2b3394ee0839cec5d9b98c11c46b3ac46e5 Mon Sep 17 00:00:00 2001
From: zeelrupapara <zeelrupapara@gmail.com>
Date: Sun, 6 Oct 2024 12:39:48 +0530
Subject: [PATCH 1/3] feat: add testcase of polynom_for_points

---
 linear_algebra/src/polynom_for_points.py | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/linear_algebra/src/polynom_for_points.py b/linear_algebra/src/polynom_for_points.py
index a9a9a8117c18..4dfc048d99bb 100644
--- a/linear_algebra/src/polynom_for_points.py
+++ b/linear_algebra/src/polynom_for_points.py
@@ -27,6 +27,12 @@ def points_to_polynomial(coordinates: list[list[int]]) -> str:
     f(x)=x^2*-1.0+x^1*-0.0+x^0*-2.0
     >>> print(points_to_polynomial([[1, 5], [2, 2], [3, 9]]))
     f(x)=x^2*5.0+x^1*-18.0+x^0*18.0
+    >>> print(points_to_polynomial([[1, 1], [1, 2], [1, 3]]))
+    x=1
+    >>> print(points_to_polynomial([[1, 1], [2, 2], [2, 2]]))
+    Traceback (most recent call last):
+        ...
+    ValueError: The program cannot work out a fitting polynomial.
     """
     if len(coordinates) == 0 or not all(len(pair) == 2 for pair in coordinates):
         raise ValueError("The program cannot work out a fitting polynomial.")

From 8ca1fea7f4d5e6effed7c9fdb4909cabf9619e46 Mon Sep 17 00:00:00 2001
From: zeelrupapara <zeelrupapara@gmail.com>
Date: Sun, 6 Oct 2024 16:33:47 +0530
Subject: [PATCH 2/3] fix: remove the print from the testcase of
 points_to_polynomial

---
 linear_algebra/src/polynom_for_points.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/linear_algebra/src/polynom_for_points.py b/linear_algebra/src/polynom_for_points.py
index 4dfc048d99bb..e74fed03a5e3 100644
--- a/linear_algebra/src/polynom_for_points.py
+++ b/linear_algebra/src/polynom_for_points.py
@@ -27,9 +27,9 @@ def points_to_polynomial(coordinates: list[list[int]]) -> str:
     f(x)=x^2*-1.0+x^1*-0.0+x^0*-2.0
     >>> print(points_to_polynomial([[1, 5], [2, 2], [3, 9]]))
     f(x)=x^2*5.0+x^1*-18.0+x^0*18.0
-    >>> print(points_to_polynomial([[1, 1], [1, 2], [1, 3]]))
-    x=1
-    >>> print(points_to_polynomial([[1, 1], [2, 2], [2, 2]]))
+    >>> points_to_polynomial([[1, 1], [1, 2], [1, 3]])
+    'x=1'
+    >>> points_to_polynomial([[1, 1], [2, 2], [2, 2]])
     Traceback (most recent call last):
         ...
     ValueError: The program cannot work out a fitting polynomial.

From 0b8c9a5357b69e37e735c00fe590b7f4e034109c Mon Sep 17 00:00:00 2001
From: zeelrupapara <zeelrupapara@gmail.com>
Date: Mon, 7 Oct 2024 09:46:53 +0530
Subject: [PATCH 3/3] fix: remove print statement from old test cases

---
 linear_algebra/src/polynom_for_points.py | 36 ++++++++++++------------
 1 file changed, 18 insertions(+), 18 deletions(-)

diff --git a/linear_algebra/src/polynom_for_points.py b/linear_algebra/src/polynom_for_points.py
index e74fed03a5e3..452f3edd4aee 100644
--- a/linear_algebra/src/polynom_for_points.py
+++ b/linear_algebra/src/polynom_for_points.py
@@ -3,30 +3,30 @@ def points_to_polynomial(coordinates: list[list[int]]) -> str:
     coordinates is a two dimensional matrix: [[x, y], [x, y], ...]
     number of points you want to use
 
-    >>> print(points_to_polynomial([]))
+    >>> points_to_polynomial([])
     Traceback (most recent call last):
         ...
     ValueError: The program cannot work out a fitting polynomial.
-    >>> print(points_to_polynomial([[]]))
+    >>> points_to_polynomial([[]])
     Traceback (most recent call last):
         ...
     ValueError: The program cannot work out a fitting polynomial.
-    >>> print(points_to_polynomial([[1, 0], [2, 0], [3, 0]]))
-    f(x)=x^2*0.0+x^1*-0.0+x^0*0.0
-    >>> print(points_to_polynomial([[1, 1], [2, 1], [3, 1]]))
-    f(x)=x^2*0.0+x^1*-0.0+x^0*1.0
-    >>> print(points_to_polynomial([[1, 3], [2, 3], [3, 3]]))
-    f(x)=x^2*0.0+x^1*-0.0+x^0*3.0
-    >>> print(points_to_polynomial([[1, 1], [2, 2], [3, 3]]))
-    f(x)=x^2*0.0+x^1*1.0+x^0*0.0
-    >>> print(points_to_polynomial([[1, 1], [2, 4], [3, 9]]))
-    f(x)=x^2*1.0+x^1*-0.0+x^0*0.0
-    >>> print(points_to_polynomial([[1, 3], [2, 6], [3, 11]]))
-    f(x)=x^2*1.0+x^1*-0.0+x^0*2.0
-    >>> print(points_to_polynomial([[1, -3], [2, -6], [3, -11]]))
-    f(x)=x^2*-1.0+x^1*-0.0+x^0*-2.0
-    >>> print(points_to_polynomial([[1, 5], [2, 2], [3, 9]]))
-    f(x)=x^2*5.0+x^1*-18.0+x^0*18.0
+    >>> points_to_polynomial([[1, 0], [2, 0], [3, 0]])
+    'f(x)=x^2*0.0+x^1*-0.0+x^0*0.0'
+    >>> points_to_polynomial([[1, 1], [2, 1], [3, 1]])
+    'f(x)=x^2*0.0+x^1*-0.0+x^0*1.0'
+    >>> points_to_polynomial([[1, 3], [2, 3], [3, 3]])
+    'f(x)=x^2*0.0+x^1*-0.0+x^0*3.0'
+    >>> points_to_polynomial([[1, 1], [2, 2], [3, 3]])
+    'f(x)=x^2*0.0+x^1*1.0+x^0*0.0'
+    >>> points_to_polynomial([[1, 1], [2, 4], [3, 9]])
+    'f(x)=x^2*1.0+x^1*-0.0+x^0*0.0'
+    >>> points_to_polynomial([[1, 3], [2, 6], [3, 11]])
+    'f(x)=x^2*1.0+x^1*-0.0+x^0*2.0'
+    >>> points_to_polynomial([[1, -3], [2, -6], [3, -11]])
+    'f(x)=x^2*-1.0+x^1*-0.0+x^0*-2.0'
+    >>> points_to_polynomial([[1, 5], [2, 2], [3, 9]])
+    'f(x)=x^2*5.0+x^1*-18.0+x^0*18.0'
     >>> points_to_polynomial([[1, 1], [1, 2], [1, 3]])
     'x=1'
     >>> points_to_polynomial([[1, 1], [2, 2], [2, 2]])