Advertisement
Guest User

Untitled

a guest
Dec 29th, 2014
170
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. #-------------------------------------------------------------------------------
  2. # Name: module1
  3. # Purpose:
  4. #
  5. # Author: afroz.hussain
  6. #
  7. # Created:
  8. # Copyright: (c) afroz.hussain
  9. # Licence: <your licence>
  10. #-------------------------------------------------------------------------------
  11.  
  12. def fibonacci(num):
  13. if num == 0:return 0
  14. if num == 1: return 1
  15. return ( fibonacci(num-1) + fibonacci(num -2))
  16.  
  17.  
  18.  
  19. def main():
  20. print "Printing fibonacci series. \n"
  21. for x in range(0, 10):
  22. print fibonacci(x)
  23.  
  24.  
  25. if __name__ == '__main__':
  26. main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement