nums = [1, 100]

def extend_nums(nums, min_needed):
    while len(nums) < min_needed:
        for index in range(1, len(nums), 2):
            nums.insert(index, mean(nums[index - 1], nums[index]))
return nums

def mean(x, y):
    return (x + y) / 2
How can a list be extended uniformly to include extrapolated mean values?