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 details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

is_natural_number-1.0.0-py3-none-any.whl (3.1 kB view details)

Uploaded Python 3

File details

Details for the file is-natural-number-1.0.0.tar.gz.

File metadata

  • Download URL: is-natural-number-1.0.0.tar.gz
  • Upload date:
  • Size: 1.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.2

File hashes

Hashes for is-natural-number-1.0.0.tar.gz
Algorithm Hash digest
SHA256 a169d3a3f4942173061382b87daddfb0fc25662191739717ef9957901ac8c67b
MD5 879a4d16967c496a6545a6cec2dc7ebd
BLAKE2b-256 c07feb58555616fb50dfbfdf1d3a89d1807e726c29fc2b4c539aa895037d6493

See more details on using hashes here.

File details

Details for the file is_natural_number-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: is_natural_number-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 3.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.2

File hashes

Hashes for is_natural_number-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d61d664426ad20420f3af5357da9f3d794b51194b2c5aff058c2578a6aed650f
MD5 bb1f719123d42fbc7835b7b23f5c148d
BLAKE2b-256 da4ffcf9ad6b11f686b087330a7ab0a858e2f788c966a1f8fc508ba18ac01946

See more details on using hashes here.

Supported by

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