基于输入数组大小递增变量的公式

Formula with incrementing variable based on input array size

假设我有一个螺旋层,其中的内径和层数是可变的。但是层数有名称(角度)。 示例:

ID = 20
Layers = (45, 60, 30)
Layer_thickness = 0.5 

我想输出一个数组,其中包含 'Layers' 中每个组件的计算结果。此计算将使用第一个组件的 ID,并且对于每个后续组件的计算将添加另一层厚度

带有示例公式的代码开头是:

a = []    
    for n, i in Layers:
        a0 = abs((math.pi*ID) / math.tan(math.radians(i)))
        a.append(a0)

我不知道如何根据层的索引按厚度递增变量 ID。我知道我可以很容易地制作另一个看起来像 (20, 20.5, 21) 的数组,但我想保留输入数组 'Layer' 可以包含更多或更少组件的灵活性。

对于这个例子,有人可以提出一个遵循最后一个约束并输出以下数组(不必被截断)的解决方案:

a = [37.27, 67.73, 43.66]

如果您尝试获取索引以生成 (20, 20.5, 21),请尝试

ID = 20
Layers = (45, 60, 30)
Layer_thickness = 0.5 

for i, layer in enumerate(Layers):
    value = i*Layer_thickness + ID
    print(value, layer)

否则,您只是想像往常一样添加到 ID 上

for layer in Layers:
    value = ID
    print(value, layer) 
    ID += Layer_thickness