Python | Numpy numpy.ndarray.__invert__()
With the help of
Numpy numpy.ndarray.__invert__(), one can invert the elements of an array. We don’t have to provide any type of parameter but remember that this method only works for integer values.
Syntax: ndarray.__invert__($self, /)
Example #1 :
In this example we can see that every element in an array is operated on a unary operator that is ~ with the help of
[-2 -3 -4 -5 -6]
Example #2 :
[[-2 -3 -4 -5 -6] [-7 -6 -5 -4 -3]]
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning – Basic Level Course