SHARE
TWEET

CSH2012 LAB12 factorial.py

calcpage Jun 1st, 2013 185 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/usr/bin/python
  2. #factorial.py    MrG    2013.0517
  3.  
  4. def fact(n):
  5.     if n==0:
  6.         return 1
  7.     else:
  8.         return n*fact(n-1)
  9.  
  10. print "i\tfact(i)"
  11. for i in range(100):
  12.     print i,"\t",fact(i)
RAW Paste Data
Want to get better at Python?
Learn to code Python in 2017
Top