1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

[Python] What's the function like sum() but for multiplication? product()?

Discussão em 'Python' iniciado por Stack, Setembro 16, 2024.

  1. Stack

    Stack Membro Participativo

    Python's sum() function returns the sum of numbers in an iterable.

    sum([3,4,5]) == 3 + 4 + 5 == 12


    I'm looking for the function that returns the product instead.

    somelib.somefunc([3,4,5]) == 3 * 4 * 5 == 60


    I'm pretty sure such a function exists, but I can't find it.

    Continue reading...

Compartilhe esta Página