educative.io

There is no math.prod in Python here? Python version < 3.8?

Tried to use math.prod to find a product of the list, but there is
AttributeError: module ‘math’ has no attribute ‘prod’

As far as I know it should be there starting from Python 3.8 - math — Mathematical functions — Python 3.8.12 documentation, here the version is older?

Hello @Dmitry_Polovinkin,

Yes, you are right in python 3.8; we can use math.prod function by just importing the library and without any installation.

But in the challenge, it is asked that you have to implement the find_product(lst) by yourself. So that’s why you cannot use any built-in function for that, and to restrict that, we are using the older version of python.

I hope I have answered your query; please let me know if you still have any confusion.

Thank You :blush:

1 Like

Ah, I see, got it, thanks! Anyway found a way to implement that manually, it’s definitely more interesting to do it by yourself :slight_smile:

1 Like