Skip to main content

Add the first X Pi digits

Project description

Py digits

GitHub release lint Code style: black

This library was inspired by this meme:

Robot captcha meme

Now we can easily solve it in less than a second!

Getting started

Install the library with:

pip install -U py-digits

Usage

from pydigits import sum_pi_digits

print(sum_pi_digits(31_415, 'odd'))
# 78662

print(sum_pi_digits(31_415, 'odd', 'binary'))
# 10011001101000110

Documentation

pi_digits

function pydigits.pi_digits(decimals)

Function that returns the pi number rounded to the number of digits given has an argument.

Parameters

  • decimals: int. Number of digits of pi requested.

sum_pi_digits

function sum_pi_digits(decimals, nature="all", notation="decimal")

Parameters

  • decimals: int. Number of digits of pi requested.

  • nature: "all", "even" or "odd", default "all". The nature of the digits of pi taht you want to count for your sum.

  • notation: "decimal" or "binary", default "decimal". The notation of the answer obtained.

Testing

Run the test suite with:

python -m unittest tests

Install Local

To install it locally from the source code:

python setup.py develop

Change Log

1.0.0 (15/02/2022)

  • First Release

1.0.1 (15/02/2022)

  • Fix missing dependencies

1.0.2 (18/02/2022)

  • Add functions description documentation

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

py-digits-1.0.2.tar.gz (78.4 kB view hashes)

Uploaded Source

Built Distribution

py_digits-1.0.2-py3-none-any.whl (3.4 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page