Write a function that creates a new figure (a new broken line) out of a given broken line. It would take as parameter a list of (max) 20 points representing the closed broken line. The output must be a plot with the two figures in different colors.
The new figure is created by connecting midpoints of consecutive segments of the figure.
Suggestion. Keep the coordinates of the randomly generated points in a symmetrical interval, for simplicity.
Observation. A closed broken line is a figure made of segments such that each segment's left endpoint is connected to another segment's right endpoint.
Given four points, the output should be similar to this: