print first 10 numbers of fibonacci sequence using python using recursive way code example

Example 1: fibonacci sequence python

# WARNING: this program assumes the
# fibonacci sequence starts at 1
def fib(num):
  """return the number at index num in the fibonacci sequence"""
  if num <= 2:
    return 1
  return fib(num - 1) + fib(num - 2)


print(fib(6))  # 8

Example 2: code fibonacci python

# Program to display the Fibonacci sequence forever

def fibonacci(i,j):
  print(i;fibonacci(j,i+j))
fibonacci(1,1)