Skip to content

Instantly share code, notes, and snippets.

@esenthil2018
Created January 17, 2022 08:03
Show Gist options
  • Save esenthil2018/4374beb2f810195244110f90e1c09046 to your computer and use it in GitHub Desktop.
Save esenthil2018/4374beb2f810195244110f90e1c09046 to your computer and use it in GitHub Desktop.
from functools import lru_cache
@lru_cache()
def factor(n):
print('Factor{0}!'.format(n))
return 1 if n < 2 else n * factor(n-1)
factor(5)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment