DEV Community

Cover image for Fibonacci Sequencer
Scott Gordon
Scott Gordon

Posted on • Edited on

2 1

Fibonacci Sequencer

# fibonacci_sequence.py
#   This program computes the nth Fibonacci number where n is a value input
#   by the user.
# by: Scott Gordon

def main():
print("***** Welcome to the Fibonacci Sequencer *****\n")

    n = int(input("Enter the value of n: "))
    curr, prev = 1, 1
    for i in range(n-2):
        curr, prev = curr+prev, curr

    print("The nth Fibonacci number is", curr)


if __name__ == '__main__':
    main()
Enter fullscreen mode Exit fullscreen mode

Top comments (0)

Image of Docusign

🛠️ Bring your solution into Docusign. Reach over 1.6M customers.

Docusign is now extensible. Overcome challenges with disconnected products and inaccessible data by bringing your solutions into Docusign and publishing to 1.6M customers in the App Center.

Learn more