How to print the Fibonacci Sequence using Python?

PythonServer Side ProgrammingProgramming

Fibonacci series contains numbers where each number is sum of previous two numbers. This type of series is generated using looping statement.

Example

x=0
y=1
fibo=0
while fibo<10:
    fibo=fibo+1
    z=x+y
    print (z)
    x,y=y,z

Output

Above program print 10 numbers in Fibonacci series

1
2
3
5
8
13
21
34
55
89
raja
Updated on 21-Feb-2020 12:25:51

Advertisements