daily pastebin goal
64%
SHARE
TWEET

CSH2012 LAB12 pascal.py

calcpage Jun 1st, 2013 181 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/usr/bin/python
  2. #pascal.py     MrG    2013.0524
  3.  
  4. def pascal(n,r):
  5.     if n==r or r==0:
  6.         return 1
  7.     return pascal(n-1,r)+pascal(n-1,r-1)
  8.  
  9. for n in range(8):
  10.     for r in range(n+1):
  11.         print pascal(n,r),"\t",
  12.     print
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top