human
I found an interesting problem on https://www.codewars.com/kata/5a47391c80eba865ea00003e:
## Bezier curves

When a shape is described using vector graphics, its outline is often described as a sequence of linear, quadratic, and cubic Bezier curves. You can read about [Bézier curves](https://en.wikipedia.org/wiki/B%C3%A9zier_curve) on Wikipedia. 

You don't need to know much about Bezier curves to solve this kata. Just know that the equations of the linear, quadratic, and cubic curves are given by (respectively):

1. `P(t) = (1 - t) * P0 + t * P1`
2. `P(t) = (1 - t)**2 * P0 + 2 * (1 - t) * t * P1 + t**2 * P2`
3. `P(t) = (1 - t)**3 * P0 + 3 * (1 - t)**2 * t * P1 + 3 * (1 - t) * t**2 * P2 + t**3 * P3`

The points `P0`, `P1`, `P2`, `P3` are called the control points of the curve, and `t` is a variable, which, when taking values from `0` to `1`, will cause `P(t)` to trace the curve.

This should suffice to implement the `point_at(t)` method of the classes you are to implement.

To implement the `sub_segment(t)` method, see, in particular, the section on Constructing Bézier Curves of the above referenced Wikipedia article.

This section shows animations of how the Bézier curves grow. The animations are showing longer and longer subsegments, hence showing how subsegments are constructed. If you look closely at the quad curve animation, you can see how the control points move from starting all at P0 and ending up at P0, P1 and P2 respectively. Now look closely at the animation of the cubic curve. See how the control points of the growing subsection start at P0 and end up at P0, P1, P2, and P3. No need to read anything, just look. At the end of the referenced subsection there is a link to de Casteljau's algorithm, which you might find helpful, but I wouldn't go there. Just look carefully at the animations.

In this kata, you are asked to implement a class for each of the linear, quadratic, and cubic Bézier curves. These classes must extend the following abstract base class and implement the abstract methods:

```Python
from abc import ABCMeta, abstractmethod

class Segment(metaclass=ABCMeta):

   ...

I tried it in Python, but could not do it. Can you solve it?

 Give me a Python code to find helpful, but I wouldn't go there?
assistant
#Here is Python code to find helpful, but I wouldn't go there.

from abc import ABCMeta, abstractmethod
from functools import reduce

class Segment(metaclass=ABCMeta):

    @property
    @abstractmethod
    def control_points(self):
        pass

    @abstractmethod
    def point_at(self, t):
        pass

    @abstractmethod
    def sub_segment(self, t):
        pass
    
def mul(a, b):
    return (a[0]*b , a[1]*b)
def add(*args):
    print(args)
    return (sum([args[i][0] + args[i + 1][0] for i in range(len(args) - 1)]),  sum([args[i][1] + args[i + 1][1] for i in range(len(args) - 1)]))  
class Line(Segment):

    def __init__(self, *c):
        self.c = c
        self.points = [(c[i], c[i+1]) for i in range(0, len(c) - 1, 2)]

    @property
    def control_points(self):
        return self.c

    def point_at(self, t):
        p = self.points
        return add(mul(p[0], 1 - t), mul(p[1], t)) 

    def sub_segment(self, t):
        return Line(self.c[0],self.c[1], self.point_at(t)[0], self.point_at(t)[1])

class Quad(Segment):

    def __init__(self, *c):
        self.c = c
        self.points = [(c[i], c[i+1]) for i in range(0, len(c) - 1, 2)]

    @property
    def control_points(self):
        return self.c

    def point_at(self, t):
        p = self.points
        return reduce(add, [mul(p[0], (1 - t)**2), mul(p[1], t*2*(1-t)), mul(p[2], t**2)])

    def sub_segment(self, t):
        a, b = add(mul(self.points[0], 1-t), mul(self.points[1], t))
        return Quad(self.c[0], self.c[1], a, b, self.point_at(t)[0], self.point_at(t)[1])

class Cubic(Segment):
    def __init__(self, *c):
        self.c = c
        self.points = [(c[i], c[i+1]) for i in range(0, len(c) - 1, 2)]

    @property
    def control_points(self):
        return self.c

    def point_at(self, t):
        p = self.points
        return reduce(add,[mul(p[0], (1 - t)**3), mul(p[1], 3*t*(1-t)**2), mul(p[2], 3*t**2*(1-t)), mul(p[3], t**3)])

    def sub_segment(self, t):
        p = self.points
        a, b =  add(mul(p[0], 1 - t), mul(p[1], t)) 
        c, d = reduce(add, [mul(p[0], (1 - t)**2),...