SHARE
TWEET

Untitled

a guest Apr 20th, 2019 76 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. def fib(x):
  2.  if x in [0,1]:
  3.   return 1
  4.  
  5.  b1 = 1
  6.  b2 = 1
  7.  index = 1
  8.  while index < x:
  9.   b2,b1 = (b2 + b1,b2)
  10.   index = index + 1
  11.  
  12.  return b2
  13.  
  14. print(fib(4))
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