Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

python code to generate fibonacci series

# Function for nth Fibonacci number
 
def Fibonacci(n):
    if n<= 0:
        print("Incorrect input")
    # First Fibonacci number is 0
    elif n == 1:
        return 0
    # Second Fibonacci number is 1
    elif n == 2:
        return 1
    else:
        return Fibonacci(n-1)+Fibonacci(n-2)
 
# Driver Program
 
print(Fibonacci(10))
 
# This code is contributed by Saket Modi
Comment

how to code fibonacci series in python

def fib(n):
    a, b = 0, 1
    while a < n:
        print(a, end=' ')
        a, b = b, a+b
    print()


fib(1000)
Comment

PREVIOUS NEXT
Code Example
Python :: create a fibonacci function using a generator python 
Python :: python fibonacci sequence code 
Python :: get device name tensorflow 
Python :: convert python code to java using jython 
Python :: pandas continues update csv with exception 
Python :: api view wrapper django 
Python :: list alpha numeric 
Python :: using default as none in django mdoels 
Python :: get all methods of an instance 
Python :: polycarp and coins codeforces solution 
Python :: how to call a specific item from a list python 
Python :: Symbol to make things not equeal to something in python 
Python :: invalid literal for int() with base 10 python 
Python :: mechanize python #9 
Python :: django nested inlines 
Python :: Notice there is a bug when using astimezone() on utc time. This gives an incorrect result: 
Python :: inline_ternary(if)_condition 
Python :: get inverse of bool value python 
Python :: # merge two dictionaries 
Python :: Convert Letters to Numbers in Python Using list comprehension 
Python :: how to make a new df from old 
Python :: how to limit variable godot 
Python :: continue loop django template 
Python :: Simple Python Permutation Passing argument as the second parameter 
Python :: python faq call by reference 
Python :: code academy magic 8 bal code python 
Python :: how to add item to a list in pithon 
Python :: Loading data from Oracle Database to pandas DataFrames 
Python :: pathlib home 
Python :: 123bum123 
ADD CONTENT
Topic
Content
Source link
Name
1+3 =