def compute_centroids(groups: Iterable[Sequence[Point]]) -> List[Centroid]: 'Compute the centroid of each group' return [tuple(map(mean, transpose(group))) for group in groups]