'How to make a variable with range and i
I am trying to make a variable like this:
h = math.exp(**-i) for i in range(1, 17, 1)
It is bringing an error, but then how should I write this? Is there a better way than what im trying?
Thanks!
Solution 1:[1]
Cause question has tag numpy:
import numpy as np
powers = np.arange(1, 17)
h = np.exp(-powers)
h_list = h.tolist() # if you want list as a result
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | draw |
