Anything Simple 2
Just simple stuff ...
Wednesday, November 26, 2008
Recursive lambda implementation factorial function in Python
It is easy to implement factorial function use recursive in Python, but how do you implement it by using recursive lambda in Python? Here is my try:
fact = lambda n: (n and n-1) and n*fact(n-1) or 1
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment