Skip to main content
Join the official 2019 Python Developers SurveyStart the survey!

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


Release history Release notifications

Download files

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

Files for is-natural-number, version 1.0.0
Filename, size File type Python version Upload date Hashes
Filename, size is_natural_number-1.0.0-py3-none-any.whl (3.1 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size is-natural-number-1.0.0.tar.gz (1.9 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page