0

Why does the error occur? What am I doing wrong?

https://code.sololearn.com/c8a9a2023A22

28th Feb 2021, 10:08 AM
Mary_d9
Mary_d9 - avatar
10 Respostas
+ 2
(1 + 0.014) ** L is equal to 1.014^L where L is a list
28th Feb 2021, 10:19 AM
Abhay
Abhay - avatar
+ 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.
28th Feb 2021, 11:33 AM
Abhay
Abhay - avatar
+ 1
Mary_d9 what do you want to do ? Can you show the output you are expecting ?
28th Feb 2021, 11:06 AM
Abhay
Abhay - avatar
+ 1
And how does that output comes?
28th Feb 2021, 11:14 AM
Abhay
Abhay - avatar
+ 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
28th Feb 2021, 11:16 AM
Mary_d9
Mary_d9 - avatar
+ 1
Mary_d9 you have to use starmap or accumulate only?
28th Feb 2021, 11:29 AM
Abhay
Abhay - avatar
+ 1
Abhay thank you😊
28th Feb 2021, 11:36 AM
Mary_d9
Mary_d9 - avatar
0
Abhay how can my function be used for each item of "L" using accumulate or starmap? or is it impossible?
28th Feb 2021, 10:28 AM
Mary_d9
Mary_d9 - avatar
0
Abhay output: 13604.501252379501
28th Feb 2021, 11:11 AM
Mary_d9
Mary_d9 - avatar
0
Abhay not necessary
28th Feb 2021, 11:30 AM
Mary_d9
Mary_d9 - avatar