# Problem Description
This is a problem about calculating the "distance" between two elements in a list of numbers, where:
- The distance is not simply the absolute difference between two numbers
- The calculation involves all elements between and including the two indexed positions
- The result should be rounded to two decimal places
- The distance appears to be calculated using a specific mathematical formula involving squares of numbers

# Visual Facts
1. The image shows 3 examples of array calculations:
   - Example 1: Array [3, -1, 0, 2, -9, -7]
   - Example 2: Array [3, -1, 0, 2, -2, 7, -3, 1]
   - Example 3: Array [3, -4, -2, 4, -6, -5, -1.2, -2.5, 3, -2, 7, 3]

2. Each example shows multiple distance calculations with formulas:
   - Format: distance = (x₁)² + (x₂)² + ... + (xₙ)²
   - Results include both whole numbers and decimals (e.g., 68.69)

3. The calculations include decimal numbers (Example 3: -1.2, -1.5)

# Visual Patterns
1. Distance Calculation Pattern:
   - The distance is calculated by taking each number between the two index positions
   - Each number is squared
   - All squared values are summed together
   - The calculation does not include the two indexed numbers themselves

2. Special Cases:
   - When calculating distance between adjacent elements: distance = 0

3. The order of idx1 and idx2 doesn't seem to matter (the distance appears to be the same regardless of direction)

# Solution
def solution(nums: list[float], idx1: int, idx2: int) -> float:
    """
    Calculate the distance between two elements in a list of numbers.

    Parameters:
        nums (list[float]): A list of numbers.
        idx1 (int): The first index position. (0-indexed)
        idx2 (int): The second index position. (0-indexed)

    Returns:
        float: The calculated distance between the elements at the two index positions. (round two decimal places)
    """
    min_idx = min(idx1, idx2)
    max_idx = max(idx1, idx2)
    res = 0
    for i in range(min_idx+1, max_idx):
        res += nums[i] **2
    return round(res, 2)


# Test Script
def test():
    test_cases = [
        ([3,-1,0,2,-9,-7], 0, 3, 1),
        ([3,-1,0,2,10,-7], 0, 3, 1),
        ([3,-1,0,2,-2,7,-3,1], 0, 3, 1),
        ([3,-1,0,2,98,7,-3,1], 0, 3, 1),
        ([3,-4,-2,4,-6,-5,9.9,-1.5,3,-2,7,3], 10, 11, 0),
        ([3,-4,-2,4,-6,-5,-1.2,-1.5,3,-2,7,3], 10, 11, 0),
        ([2, 0, -2, 0, 10.4, 2, -1, 1, -2, 2], 5, 7, 1),
        ([2, 0, -2, 0, -2, 2, -1, 1, -2, 2], 5, 7, 1),
        ([2, -3, -1, 0.8, -2, -2, 3, -3], 0, 6, 18.64),
        ([2, -3, -1, -1, -2, -2, 3, -3], 0, 6, 19),
    ]

    for nums, idx1, idx2, expected_output in test_cases:
        try:
            output = solution(nums, idx1, idx2)
        except Exception as e:
            error_message = (
                f"An exception occurred while running the test case:\n"
                f"`nums`: {nums}\n"
                f"`idx1`: {idx1}\n" 
                f"`idx2`: {idx2}\n\n"
                f"Exception: '{str(e)}'"
            )
            assert False, error_message

        if round(output, 2) != round(expected_output, 2):
            error_message = (
                f"The following Test Case failed:\n"
                f"`nums`: {nums}\n"
                f"`idx1`: {idx1}\n"
                f"`idx2`: {idx2}\n\n"
                f"Actual Output: {round(output, 2)}\n"
                f"Expected Output: {round(expected_output, 2)}"
            )
            assert False, error_message

test()