Is There a Built-in Product() in Python? [Duplicate]

I've been looking through a tutorial and book but I can find no mention of a built in product function i.e. of the same type as sum(), but I could not find anything such as prod().

Is the only way I could find the product of items in a list by importing the mul() operator?

2

4 Answers

Pronouncement

Yes, that's right. Guido rejected the idea for a built-in prod() function because he thought it was rarely needed.

Robert Thorne

Robert Thorne

Automotive & Future Transportation Editor

Robert Thorne covers electric vehicle innovations, autonomous driving systems, global mobility trends, and automotive engineering developments.