Thursday, October 23, 2025
HomeLanguagesPython | Numpy np.legzero() method

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 legzero
import numpy as np
from numpy.polynomial.legendre import legzero
  
# using np.legzero() method
ans = legzero
  
print(ans)


Output :

[0]

Example #2 :




# 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)


Output :

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

Dominic
Dominichttp://wardslaus.com
infosec,malicious & dos attacks generator, boot rom exploit philanthropist , wild hacker , game developer,
RELATED ARTICLES

Most Popular

Dominic
32361 POSTS0 COMMENTS
Milvus
88 POSTS0 COMMENTS
Nango Kala
6728 POSTS0 COMMENTS
Nicole Veronica
11892 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11954 POSTS0 COMMENTS
Shaida Kate Naidoo
6852 POSTS0 COMMENTS
Ted Musemwa
7113 POSTS0 COMMENTS
Thapelo Manthata
6805 POSTS0 COMMENTS
Umr Jansen
6801 POSTS0 COMMENTS