Chalarangelo / 30-seconds-of-python

Short Python code snippets for all your development needs
https://www.30secondsofcode.org/python/p/1
Creative Commons Attribution 4.0 International
8.83k stars 1.26k forks source link

Added a snippet to find factorial using `math.gamma` #141

Closed hegdenischay closed 4 years ago

hegdenischay commented 4 years ago

I added a snippet that finds the factorial of a positive integer using math.gamma.

Description

This approach is marginally faster than the recursive function. I also made it accept only positive integers, because I believe it has more usability than a normal snippet of the gamma function.

What does your PR belong to?

Types of changes

Checklist: