#!/usr/bin/python
"""
functions.py -- defining and using a function
Jeff Ondich, 24 October 2006
Read, predict the output, experiment.
"""
def factorial(n):
if n < 0:
raise ValueError, "You can't take the factorial of a negative integer."
return 0
if n <= 1:
return 1
return n * factorial(n - 1)
print factorial(6)
print factorial(0)
print factorial(1)
print
print "What usually happens in Java when you compute the factorial of 20?"
print factorial(20)
print
print "Let's try a negative number"
print factorial(-5)