[code.view]

[top] / python / PyMOTW / math / math_factorial.py

     #!/usr/bin/env python
     # encoding: utf-8
     #
     # Copyright (c) 2010 Doug Hellmann.  All rights reserved.
     #
     """Factorial
     """
     #end_pymotw_header
     
     import math
     
     for i in [ 0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.1 ]:
         try:
             print '{:2.0f}  {:6.0f}'.format(i, math.factorial(i))
         except ValueError, err:
             print 'Error computing factorial(%s):' % i, err
     

[top] / python / PyMOTW / math / math_factorial.py

contact | logmethods.com