# data
i = [2,3,4]
interest = [1.08,1.0824,1.09,1.095]
def count_interests(bar, interest):
"""
Returns a list:
[(interest[0] * interest[1]), (interest[0] * interest[1] * interest[2]),
(interest[0] * interest[1] * interest[2] * interest[3])]
"""
res = []
compound = [interest[0]]
print(f'first compound {compound}')
for i in range(len(bar)): # [0,1,2]
inter = compound[i] * interest[i+1]
compound.append(inter)
print(compound)
return compound
compound = count_interests(i, interest)
compound.pop(0)
print(compound)
# [1.168992, 1.2742012800000002, 1.3952504016000002]
zipped = zip(i, compound)
def yr(zip):
res = []
for k, v in zip:
temp = v ** (1./k) - 1
res.append(temp)
return res
result = yr(zipped)
1.、(関心[ -
結果
[0.0811993340730468, 0.08412496573593131, 0.08683355662001646]
は、[([1]関心[0] *金利)**(1./i[0])この '[YR 2、YR3、yr4] =のような統合します0] * interest [1] * interest [2])**(1./i[1]) - 1.、(interest [ 0] * interest [1] * interest [2] * interest [3])**(1./i[2]) - 1.] ' あなたは何が予想されるのかを指定できますか? –
2年間:〖(1.08×1.0824)〗(1/2) - 1 = 8.12% 3年間:〖(1.08×1.0824×1.09)〗^(1/3)-1 = 8.41% 4 - 年:〖(1.08×1.0824×1.09×1.095)〗^(1/4) - 1 = 8.68% –
私は、範囲iから値を抽出し、結果を印刷する一般的な式に変換したい2年目、3年目、4年目には –