Say I have a function that calculates and returns an value:
h = 4.13566733*10**-15
c = 2.99792458*10**(8+9)
def func(x):
for i in w:
A = h*c/i
return A
w = [1]
print func(w)
Fine. But if w is a larger array, say:
w = [1 ,2, 3, 4]
The func returns for the last value in w (4). Understandebly as that is the last item in the for-loop. But how can I make the func return an array with all 4 values, something like:
[1239, 619, 413, 309]
??
Aucun commentaire:
Enregistrer un commentaire