Learn to Code : Fibonacci Sequence Generator

in #coding6 months ago (edited)

fibnac_gen.py


def fibonacci_sequence(n):
    sequence = [0,1]
    while len(sequence) < n:
        sequence.append(sequence[-1] + sequence[-2])
    return sequence

n_terms = int(input("Enter the number of terms in Fibonacci Sequence: "))
print(fibonacci_sequence(n_terms))
Sort:  

Upvoted! Thank you for supporting witness @jswit.

Coin Marketplace

STEEM 0.20
TRX 0.24
JST 0.037
BTC 96071.21
ETH 3327.74
USDT 1.00
SBD 3.21