1. Write a method that takes argument a list (of any length) and returns the sum of the exponentials of the values in the list.
”
Write a method that takes argument a list (of any length) and returns the sum of the exponentials of the values in the list.
For example:
myList = [0.1, 0.9. -1.2]
The method should find e^0.1+e^0.9+e^(-1.2) and return the value 1.812
Note: in python to find e0.1, you would do the following:
import math
math.exp(0.1)
Write your program and demonstrate it with the above example.
Take a screen shot of your implementation with along with the output for the example list above and upload your solution on Canvas.
The partial implementation of the method is shown below along with some suggestions:
import math
expsumVal = #What will you initialize it to?
def myExpSum(myList):
#your for loop comes here
#Your summing comes here. Note, as mentioned before,
#to find exponential
#use math.exp(x), where x is the variable in the for #loop
#put your return here