Thursday, October 9, 2025
HomeLanguagesPython | sympy.prod() method

Python | sympy.prod() method

With the help of sympy.prod() method, we can find the product of two integers or we can multiply the list with integers and it will return the sum of products in a list by using sympy.prod() method.

Syntax : sympy.prod(val1, val2)
Return : Return the product of numbers.

Example #1 :
In this example we can see that by using sympy.prod() method, we are able to find the product of two integers and we can find the product of list and integers and then it will return a sum of product.




# import sympy
from sympy import *
  
# Using sympy.prod() method
gfg = prod([1, 2, 3], 5)
  
print(gfg)


Output :

30

Example #2 :




# import sympy
from sympy import *
  
# Using sympy.prod() method
gfg = prod(range(1, 5))
  
print(gfg)


Output :

24

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

Most Popular

Dominic
32345 POSTS0 COMMENTS
Milvus
87 POSTS0 COMMENTS
Nango Kala
6714 POSTS0 COMMENTS
Nicole Veronica
11877 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11940 POSTS0 COMMENTS
Shaida Kate Naidoo
6834 POSTS0 COMMENTS
Ted Musemwa
7094 POSTS0 COMMENTS
Thapelo Manthata
6789 POSTS0 COMMENTS
Umr Jansen
6791 POSTS0 COMMENTS