Fibonacci series in Python

Fibonacci series: a series of numbers in which each number( Fibonacci number) is the sum of the two preceding numbers.

Define a function for Fibonacci series in Python

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

Fibonacci series in Python examples:

Get Fibonacci series in Python for below the number 1000

fib(1000) 0 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987

Get Fibonacci series for below the number 2000

fib(2000) 0 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 1597

Get Fibonacci series for below the number 10000

fib(10000) 0 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 1597 2584 4181 6765