Skip to content

Instantly share code, notes, and snippets.

View choncou's full-sized avatar
🚀
💻 🌍

Unathi Chonco choncou

🚀
💻 🌍
View GitHub Profile
@choncou
choncou / recursion.py
Last active March 4, 2016 07:35 — forked from neptunius/recursion.py
Comparison of iterative and recursive functions
import unittest
def factorial(n):
'''factorial(n) returns the product of the integers 1 through n for n >= 0,
otherwise raises ValueError for n < 0 or non-integer n'''
# implement factorial_iterative and factorial_recursive below, then
# change this to call your implementation to verify it passes all tests
...
return factorial_iterative(n)