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

Project 01: Python Code for Music Recommendation with Explanation

Iris Flowers Classification ML Project with Code