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.



filter_none

edit
close

play_arrow

link
brightness_4
code

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

chevron_right


Output :

30

Example #2 :

filter_none

edit
close

play_arrow

link
brightness_4
code

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

chevron_right


Output :

24



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.




Article Tags :

Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.