When i run this code to create my function
def create_theoretical(list1 = [], zvalues = []):
list_of_values = []
h_1 = list1[0]
omega_m1 = list1[1]
omega_l1 = list1[2]
for z in zvalues:
list_of_values.append(mu(z = z, h =h_1, omega_m = omega_m1, omega_l = omega_l1))
list_of_values = np.asarray(list_of_values)
return list_of_values
I get this error
10
11 list_of_values = []
---> 12 h_1 = list1[0]
13 omega_m1 = list1[1]
14 omega_l1 = list1[2]
TypeError: 'function' object is not subscriptable
If i switch list1 and zvalues, then the error comes for zvalues. if i put another preceding argument in the function the error goes away, but i dont want to pass anymore arguments. How do i resolve this? If i call
print(type(list1))
or
print(type(zvalues))
then the output first says that the type is a numpy array, then it says its a function. Why does the type change?