Skip to content

2. Quick start

Vasco Schiavo edited this page Dec 27, 2023 · 3 revisions

To install Sequentium, use the following command:

pip install sequentium

You can control that sequentium was indeed installed by running the following command

sequence --version

Suppose you want to work with the Fibonacci sequence. First, import it into your script:

from sequence import FibonacciSequence

fibonacci = FibonacciSequence()

Now, FibonacciSequence is a class representing the Fibonacci sequence. It behaves similarly to a list. You can iterate through it:

for x in fibonacci:
    print(x)
>> 0, 1, 1, 2, 3, 5, 8, 13, 21,...

Or you can access a specific term directly:

fibonacci[8]
>> 21

Slicing is also supported:

fibonacci[2:8]
>> [1, 2, 3, 5, 13]

Additionally, you can check if a number appears in the Fibonacci sequence:

7 in fibonacci
>> False
21 in fibonacci
>> True
Clone this wiki locally