Git Product home page Git Product logo

factordb-python's Introduction

factordb-python

.github/workflows/test.yml PyPI PyPI PyPI PyPI

The FactorDB is the database to store known factorizations for any number. This tool can use on your command line. And also you can use this tool with python 2 & 3 scripts.

Installation

The easiest way to install factordb-python is to use pip:

$ pip install factordb-python

or, if you are not installing in a virtualenv:

$ sudo pip install factordb-python

If you have the factordb-python installed and want to upgrade to the latest version you can run:

$ pip install --upgrade factordb-python

Getting Started

CLI

If you want to know the result of factorization of 16, you should type like this:

$ factordb 16

Then, you can get the answer from factordb.com.

$ factordb 16
2 2 2 2

If you want to know more detail of result, you can get an answer of JSON format.

$ factordb --json 16
{"id": "http://factordb.com/?id=2", "status": "FF", "factors": [2, 2, 2, 2]}

Library usage

If you want to use this script with Python, you should type import statement on your code like this:

from factordb.factordb import FactorDB

Then, you can get the answer with Python lists.

In [1]: from factordb.factordb import FactorDB

In [2]: f = FactorDB(16)

In [3]: f.get_factor_list()
Out[3]: []

In [4]: f.connect()
Out[4]: <Response [200]>

In [5]: f.get_factor_list()
Out[5]: [2, 2, 2, 2]

In [6]: f.get_factor_from_api()
Out[6]: [['2', 4]]

In [7]: f.get_status()
Out[7]: 'FF'

License

MIT

factordb-python's People

Contributors

r888800009 avatar ryosan-470 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.