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
Get step-by-step solutions from verified subject matter experts
