0

Can anyone help me fix the error?

import numpy as np n = 1000 dim = 100 def vector_norm(x): norm=np.zeros(x.shape[1]) for i in range(x.shape[1]): norm[i]=np.linalg.norm(x[:,i]) answer=(x[:,i]//norm[i]) return norm x=np.random.normal(0,1,(dim,n)) print(answer) #error =name 'answer' isn't defined

4th Apr 2022, 11:20 PM
parisa Shafaei
parisa Shafaei - avatar
1 Answer
+ 3
You defined answer inside a function and trying to print it outside function. What you're trying to do exactly?
5th Apr 2022, 2:49 AM
Simba
Simba - avatar