multiplying two array in python3.7 I am trying to multiply two array in python 3.7 using numpy by using the following syntax: 

array1 = np.array([{1,2,3,4},{5,6,7,8}]) 
print (array1)  
array2=array1*array1 
print(array2)  


but this error arises

TypeError: unsupported operand type(s) for *: 'set' and 'set'
You are simply defining your array so that it is made of python sets. That is a different data structure which is not able to be  multiplied, unlike an array.

Just change your code to this:

array1 = np.array([[1,2,3,4],[5,6,7,8]])


The only difference is using square brackets instead of curly ones. These are python list objects (or standard arrays).

array2=array1*array1  
print(array2)

[[ 1  4  9 16]
 [25 36 49 64]]