1
$\begingroup$

How do I multiply elements within a list?

list = {{1}, {2, 3}, {4, 5, 6}, {7}, {8,9}}

Desired output:

{1, 6, 120, 7, 72}
$\endgroup$
4

1 Answer 1

8
$\begingroup$

or type:

Apply[Times, list, {1}]

This is less elegant than the shorthand Times @@@ list but shows how Times can be applied to different levelspecs.

$\endgroup$
0

Not the answer you're looking for? Browse other questions tagged or ask your own question.