Python | Numpy np.legzero() method
np.legzero() method can be used instead of np.zeros for creating a array whose elements are 0.
Syntax :
np.legzero()
Return : Return array([0])
Example #1 :
# Python program explaining# numpy.legzero() method # import numpy and legzeroimport numpy as npfrom numpy.polynomial.legendre import legzero # using np.legzero() methodans = legzero print(ans) |
Output :
[0]
Example #2 :
# Python program explaining# numpy.legzero() method # import numpy and legzeroimport numpy as npfrom numpy.polynomial.legendre import legzero # using np.legzero() methodans = legzero + [[1, 3, 5], [2, 4, 6]] print(ans) |
Output :
[[1 3 5]
[2 4 6]]
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


