Advertisement
Python253

fibtest.py

Mar 6th, 2018
463
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.25 KB | None | 0 0
  1. #!/usr/bin/env python3.2.2
  2. ## -*- coding: utf-8 -*-
  3. # Module To Read & Write The Fibonacci Series Up To "n".
  4.  
  5. __file_name__ = 'fibtest.py'
  6. __author__ = 'Dan Evans'
  7. __copyright__ = 'Copyright 2012©, Coding With Py'
  8. __credits__ = 'Dan Evans'
  9. __dct_url__ = 'http://purl.org/dc/terms/'
  10. __license__ = 'Creative Commons'
  11. __rel_url__ = 'http://creativecommons.org/licenses/by-nc/4.0/'
  12. __version__ = 'CC-by-nc/4.0/'
  13. __maintainer__ = 'Dan(Python253)Evans'
  14. __email__ = 'Python253@gmail.com'
  15.  
  16. print('\n','','fibtest.py is licensed under',
  17.     'The Creative Commons Attribution-NonCommercial 4.0 International License',
  18.     '\n'*2,'File Name: '+__file_name__,'\n','Author: '+__author__,
  19.     '\n','Copyright: '+__copyright__,'\n','Credits: '+__credits__,
  20.     '\n','DCT URL: ','\n',__dct_url__,'\n','License: '+__license__,
  21.     '\n','Release URL: ','\n',__rel_url__,'\n','Version: '+__version__,
  22.     '\n','Maintainer: '+__maintainer__,'\n','Email: '+__email__,'\n')
  23.  
  24. # Fibonacci numbers module
  25. def fib(n): # write Fibonacci series up to n
  26.   a, b = 0, 1
  27.   while b < n:
  28.     print b,
  29.     a, b = b, a+b
  30. def fib2(n): # return Fibonacci series up to n
  31.   result = []
  32.   a, b = 0, 1
  33.   while b < n:
  34.     result.append(b)
  35.     a, b = b, a
  36.   return result
  37. #End
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement