Last active
          August 29, 2015 13:56 
        
      - 
      
 - 
        
Save SpotlightKid/8942525 to your computer and use it in GitHub Desktop.  
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | cpdef int fib(int n): | |
| if n == 2: | |
| return 2 | |
| elif n < 0: | |
| raise NotImplementedError | |
| elif n <= 1: | |
| return 1 | |
| else: | |
| return fib(n-1) + fib(n-2) | |
| if __name__ == '__main__': | |
| print(fib(40)) | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
            
Tail recursive version