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 :

filter_none

edit
close

play_arrow

link
brightness_4
code

    
# Python program explaining
# numpy.legzero() method 
  
# import numpy and legzero
import numpy as np
from numpy.polynomial.legendre import legzero
  
# using np.legzero() method
ans = legzero
  
print(ans)

chevron_right


Output :

[0]



Example #2 :

filter_none

edit
close

play_arrow

link
brightness_4
code

# Python program explaining
# numpy.legzero() method 
  
# import numpy and legzero
import numpy as np
from numpy.polynomial.legendre import legzero
  
# using np.legzero() method
ans = legzero + [[1, 3, 5], [2, 4, 6]]
  
print(ans)

chevron_right


Output :

[[1 3 5]
[2 4 6]]

My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.