Program to print the Fibonacci sequence up to a given number using a while loop in Python:

 # While loop in Python - Fibonacci sequence

num = int(input("Enter a number: "))

a, b = 0, 1

while a <= num:

    print(a)

    a, b = b, a + b


Comments

Popular posts from this blog

Simple Python Program Code for Snake Game

Iris Flowers Classification ML Project with Code

Data exploration and scatter plot visualization in Python using Pandas and Matplotlib