Question: Given the following code the make sure it has the ability to recursively kink polygons import matplotlib.pyplot as plt def kink_polygon(poly): xs, ys = zip(*poly)

Given the following code the make sure it has the ability to recursively kink polygons

import matplotlib.pyplot as plt

def kink_polygon(poly): xs, ys = zip(*poly) #create lists of x and y values

return xs,ys

def draw_polygon(*poly):

plt.figure(figsize=(4,4))

plt.plot(*poly) plt.show()

check if it can pass the following tests

test 1

poly1 = [(0, 0), (1, 2), (2, 0)]

poly2 = kink_polygon(poly1)

draw_polygon(*poly2)

test 2

poly3 = kink_polygon(*poly2)

draw_polygon(*poly3)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!