我想将几个数组添加在一起,但它们的大小不同。
我认为代码应该是这样的
commission = [0.55,0.03,0.025,0.025]
interest = [0.05,0.045]
premium = 10
fund = []
for i = 1 to 120
fund[i] = premium * (1 - commission[i]) + interest[i] * fund[i-1]
但问题是这会越界。我只是希望佣金 [4] 扩展到所有 120 个时期。与兴趣数组相同。过去我通常在 for 循环中使用“upperbound”命令来做这个计算。
在python中是怎么做的?
ITMISS
慕标5832272
相关分类