0
Why does the error occur? What am I doing wrong?
10 Respostas
+ 2
(1 + 0.014) ** L is equal to 1.014^L where L is a list
+ 2
Then you can easily do it using map function,
L = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]
U = list(map(lambda x:(110000 - 45000) / ((1 + 0.014) ** x),L))
print(f"NPV: {sum(U)}")
I can't figure how to do using starmap or accumulate.
+ 1
Mary_d9 what do you want to do ? Can you show the output you are expecting ?
+ 1
And how does that output comes?
+ 1
Abhay I have a formula: (rd - rz) / (1 + r) ** n and n are elements of a list, I need to execute this formula with different n and add all the values together like (rd - rz) / (1 + r ) ** 1+ (rd - rz) / (1 + r) ** 2 and so on
+ 1
Mary_d9 you have to use starmap or accumulate only?
+ 1
Abhay thank you😊
0
Abhay how can my function be used for each item of "L" using accumulate or starmap? or is it impossible?
0
Abhay output: 13604.501252379501
0
Abhay not necessary