I was working on a mini project which I intended to use pure Python without any external library.
But at a certain point, I got a TypeError like this
TypeError: unsupported operand type(s) for ** or pow(): 'list' and 'int'. It was as a result of trying to directly square up all elements in a list like this:
my_list = [0, 7, 2, 9]
print(my_list ** 2)
import numpy as np my_list = np.array([0, 7, 2, 9]) print(my_list ** 2)# prints array[0, 49, 4, 9]