Complete the code to import the convex hull function from scipy.spatial.
from scipy.spatial import [1] points = [[0, 0], [1, 1], [1, 0], [0, 1]] hull = ConvexHull(points)
The correct function to import is ConvexHull with exact casing from scipy.spatial.
Complete the code to create a convex hull object from the points array.
import numpy as np from scipy.spatial import ConvexHull points = np.array([[0, 0], [1, 1], [1, 0], [0, 1]]) hull = [1](points)
The convex hull object is created by calling ConvexHull(points).
Fix the error in accessing the convex hull vertices.
import numpy as np from scipy.spatial import ConvexHull points = np.array([[0, 0], [1, 1], [1, 0], [0, 1]]) hull = ConvexHull(points) vertices = hull.[1]
The convex hull vertices are accessed using hull.vertices.
Fill both blanks to create a dictionary of hull vertices and their coordinates.
vertex_coords = {hull.[1][i]: points[hull.[2][i]] for i in range(len(hull.vertices))}Both blanks should be vertices to access the indices of hull vertices.
Fill all three blanks to compute the perimeter of the convex hull polygon.
import numpy as np perimeter = 0 for i in range(len(hull.[1])): start = points[hull.[2][i]] end = points[hull.[3][(i + 1) % len(hull.vertices)]] perimeter += np.linalg.norm(end - start)
All blanks should be vertices to iterate over the hull vertex indices and compute distances between consecutive points.
