Skip to main content

Check if a value is a natural number

Project description

is-natural-number

Check if a value is a natural number.

I'm aspiring to make open-source my full-time work. If you or your company likes the work that I do, please consider supporting me.

Coffee PayPal

Install

pip install is_natural_number

Usage

from is_natural_number import isNaturalNumber

isNaturalNumber(5)            // True
isNaturalNumber(0)            // False
isNaturalNumber(0, True)      // True
isNaturalNumber(-5)           // False
isNaturalNumber('-45')        // False

API

isNaturalNumber(value, includeZero)

value: int, str - Value to check

includeZero: bool - Whether or not to consider 0 as a natural number.

Test

python test.py

Contribute

Don't be scared raise an issue or a pull request! Any contributions, no matter how big or small will land your picture here.

Adam Zerella

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

is-natural-number-1.0.0.tar.gz (1.9 kB view hashes)

Uploaded Source

Built Distribution

is_natural_number-1.0.0-py3-none-any.whl (3.1 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