Home » Python Programs » Fibonacci Series in Python Using While Loop

# Fibonacci Series in Python Using While Loop

Basic fibonacci series in python using while loop. python code for fibonacci series. For beginners, this program will print the fibonacci series number in the Python programming language. The Fibonacci sequence program is the most important program for anyone learning a new programming language.

## Fibonacci Series in Python

The Fibonacci Series is a numerical pattern in which each number is the sum of the previous two consecutive numbers. The first two integers are 0 and 1. 0+1=1 is the third number in the series. The fourth number is the sum of the second and third numbers, which is 1+1=2 and so on.

Fibonacci levels are utilised as guidelines to identify potential locations for trade development. Prior to acting on the Fibonacci level, the price should confirm. Traders don’t know which level will be crucial ahead of time, so they must wait and watch which level the price respects before entering a trade.

## If Else Statement in Python

If not, then A Python statement determines whether or not an expression is true or false. The “if” statement is executed if a condition is met. Otherwise, the “otherwise” phrase takes effect. This is when conditional statements come into play. Conditional statements allow you to more efficiently manage the flow of your program. Here we have executed the program using fibonacci series in python using while loop

## While Loop in Python

Python While Loop is used to run a series of statements until a certain condition is met. When the condition is met, the line immediately after the loop in the program is performed. While loop is an example of endless iteration.

## Fibonacci Series in Python Using While Loop

``````a = int(input("How many numbers do you want? "))
n1 = 0
n2 = 1
num = 2
if a <= 0:
print("enter the number")
elif a == 1:
print("Fibonacci series")
print(n1)
else:
print("Fibonacci series")
print(n1,",",n2,end=', ')
while num < a:
nth = n1 + n2
print(nth,end=' , ')
n1 = n2
n2 = nth
num += 1``````

Output:

How many numbers do you want?

5

Fibonacci sequence: 0 , 1, 1 , 2 , 3

Python Program to Remove an Element from a List

Python Program to Update Value in List of Dictionary

Ascending Order in Java Using If Else Statement

Addition of Two Numbers in Swift

Print List in Python

Length of List Python

Different Data Types in Single Program in Python List

Numbers Assigned to List Values in Python

Element Values Assigned to List in Python

List Values Reverse in Python

Applications for Python | Python.org

GDB online Debugger | Compiler – Code, Compile, Run, Debug online C, C++

Online Compiler and Editor/IDE for Java, C/C++, PHP, Python, Perl, etc

Python (programming language) – Wikipedia