Giter Site home page Giter Site logo

fibonacci-sequence-library's Introduction

Fibonacci Sequence Python Library

Introduction

This Python library provides various methods to generate Fibonacci sequences. It offers a simple interface to produce sequences either through recursive, non-recursive approaches, or using a generator.

Installation

Clone the Fibonacci Sequence Library from GitHub, first ensure you have Python 3.x & git are installed. Then run the following command:

git clone https://github.com/alpeshkumar9/fibonacci-sequence-library.git

Create and activate the virtual environment

cd fibonacci-sequence-library
python -m venv venv
source venv/bin/activate

To generate source and wheel distributions in the dist/ directory,

pip install build
python -m build

To install the fibonaccisequencelib library use.

pip install dist/fibonaccisequencelib-0.1.0.tar.gz

Replace fibonaccisequencelib-0.1.0.tar.gz package name with the one inside the dist folder if different.

Usage

1. Using command line:

Generate a Fibonacci sequence from the command line by executing the command:

fibonacci

It will ask for user input. Enter any value for n. For n=5, it will generate below response:

Fibonacci Sequence Library Demonstration
Enter the length of the Fibonacci sequence (n): 5

Recursive Fibonacci:
[0, 1, 1, 2, 3]

Non-Recursive Fibonacci:
[0, 1, 1, 2, 3]

Fibonacci Generator:
0 1 1 2 3

2. Using Import

Importing the Library

from fibonaccisequencelib.fibonacci import Fibonacci

Generating a Fibonacci Sequence

The library offers three methods to generate a Fibonacci sequence:

  1. Recursive Method:
fib = Fibonacci(10)
print(fib.recursive())
  1. Non-Recursive Method:
fib = Fibonacci(10)
print(fib.non_recursive())
  1. Using a Generator:
fib = Fibonacci(10)
for number in fib.generator():
    print(number, end=" ")

Run the Tests with Coverage:

To run the tests with coverage measurement, use

pytest -v

In the terminal, the coverage percentage for each module or package that was tested will be shown.

Screenshot 2023-12-02 at 4 26 28 pm

License

This project is licensed under the GNU License - see the LICENSE file for details.

Contact

For any support or queries, feel free to reach out via GitHub Issues.

Improvements

Packaging and Distribution

  • Set up continuous integration and continuous deployment (CI/CD) pipelines for automated testing and distribution.
  • Publish the package to PyPI for easier installation using pip.

fibonacci-sequence-library's People

Contributors

alpeshkumar9 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.