Header Ads

Python - WAP to Print the Fibonacci in Python - 05



This Python Code prints the List of the Fibonacci Series in Python 3.

Source Code:

#!/usr/bin/python3

while True:

    num = int(input("Maximum Number of Series : "))

    first = 0
    second = 1
    result = [0]

    print ("Fibonacci Series is :")
    for idx in range(0, num):
        third = first + second
        result.append(second)
        first = second
        second = third
    print ("", result)

    print ("- Codegig.org")

    if (input("To Continue ['y'/'n'] :") == 'y'):
        continue
    else:
        break

Program Output:

....

No comments