The Fibonacci sequence is a set of numbers that starts with a one or a zero, followed by a one, and proceeds based on the rule that each number (called a Fibonacci number) is equal to the sum of the preceding two numbers.
The purpose of this Python script is to check if an entered number is part of the Fibonnacci Sequence or Not
The Fibonacci Sequence (1,1,2,3,5,8,13,21,34,55,89,144,233,377...... is derived as below
def CheckForFibonacci(): # Next, asking user to define their target number to check numberToCheck = int(input("Enter Number: "))
numZero = 0
numOne = 1
numTwo = 1
if (numberToCheck == 0 or numberToCheck == 1):
print("The Number is a part of Fibonacci Sequence")
else:
while numZero < numberToCheck:
numZero = numOne + numTwo
numTwo = numOne
numOne = numZero
if numZero == numberToCheck:
print("The Number is part of Fibonacci Sequence")
else:
print("NO!, Number NOT part of Fibonacci Sequence")
CheckForFibonacci()
Other External Resources To find out more on creating the Fibonacci Sequence, please visit https://www.programiz.com/python-programming/examples/fibonacci-sequence and https://factpros.com/fibonacci-sequence-facts/