Get the App
SLTechnology News&Howtos  ›  Development  › 

How python calculates the factorial of any number in a row

Shulou Source: shulou.com Published: 2022-06-01 06:20:07 10月01日 Update

Editor to share with you how python calculates the factorial of any number in a row, I believe most people don't know much about it, so share this article for your reference. I hope you can learn a lot after reading this article. Let's learn about it together.

Calculates the factorial of any number in a row. Python 2.x.result = (lambda k: reduce (int.__mul__, range (1) (1) (3) print (result) #-> 6Python 3.x.import functoolsresult = (lambda k: functools.reduce (int.__mul__, range (1) (3) print (result)

#-> 6

The above is all the content of the article "how to calculate the factorial of any number in a row by python". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Tags: Line number factorial article content not much most more knowledge industry information information channel channel reference learning help Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno NVidia vpn Redmi OPPO Reno Docker