def cost(assignment, costs):
    """
    Given an assignemnt and a cost matrix, returns the cost of the
    assignment.
    """
    cost = 0.0
    for row, col in enumerate(assignment):
        cost += costs[row][col]
    return cost
