计算抛物线返回列表的最大最小值的差

问题遇到的现象和发生背景

如何计算抛物线𝑥𝑖=(𝑖−2)2−4 , for 1≤𝑖≤𝑛 返回列表的最大值和最小值之间的差值
Using your parabola in Part A, write another function that computes the difference between the maximum and minimum of the returned list of parabola. Make sure your function call the parabola function -- it should NOT reimplement its functionality.

问题相关代码,请勿粘贴截图

#Part A
def parabola(n):
xi=[]
for i in range(1,n+1,1):
type(n)==int and if n>=1:
xi.append((i-2)**2-4)
else:
raise ValueError
return xi

print(parabola(n))


def parabola(n):
    xi = []
    for i in range(1, n + 1, 1):
        if n >= 1 and isinstance(n, int):
            xi.append((i - 2) ** 2 - 4)
        else:
            raise ValueError
    return max(xi)-min(xi)


n = int(input())
print(parabola(n))