Header Ads

Python - WAP to Print GoldenRatio of a Fibonacci in Python 3.5 - 07


This is a Python Code to generate the Golden Ratio of a Fibonacci Series, using Python 3.5

Source Code:

#!/usr/bin/python3

while True:

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

    first = 0
    second = 1
    result = [0]

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

    print ("- CodeGig.org")

    if (input(" To continue 'y' : ") == 'y'):
        continue
    else:
        break

Program Output:


....

No comments