fibonacci series python recursion
# By recursion
def fib(n):
if n == 1 or n == 2:
return 1
else:
return(fib(n-1) + fib(n-2))
n = 6
for i in range(1,n+1):
print(fib(i))
fibonacci series python recursion
# By recursion
def fib(n):
if n == 1 or n == 2:
return 1
else:
return(fib(n-1) + fib(n-2))
n = 6
for i in range(1,n+1):
print(fib(i))
fibonacci sequence python
num = 1
num1 = 0
num2 = 1
import time
for i in range(0, 10):
print(num)
num = num1 + num2
num1 = num2
num2 = num
time.sleep(1)
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us