Skip to main content

A tiny Python library for checking whether numbers are even or odd.

Project description

Am I Even Or Odd

PyPI version CI Python versions License: MIT

A tiny Python package that answers one simple question: is your number even, or odd tho?

Yes, n % 2 == 0 does the same thing :)

Installation

pip install am-i-even-or-odd

Usage

from am_i_even_or_odd import is_it_even_tho, is_it_odd_tho

print(is_it_even_tho(4))
print(is_it_odd_tho(5))

Output

True
True

Error handling

Only int values are accepted. Anything else — floats, strings, None, booleans — raises a TypeError with a message explaining why, rather than silently returning a possibly-wrong answer:

>>> is_it_even_tho(4.0)
TypeError: expected an int, got 'float' (4.0). Floats and other
numeric types aren't supported to avoid ambiguity around what
counts as 'even' or 'odd'.

Development

git clone https://github.com/KenKambi/am-i-even-or-odd.git
cd am-i-even-or-odd
pip install -e ".[dev]"
pytest -v

Contributions and issues are welcome — see the issue tracker.

Changelog

See CHANGELOG.md.

License

MIT — see LICENSE.

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

am_i_even_or_odd-0.2.0.tar.gz (4.0 kB view details)

Uploaded Source

Built Distribution

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

am_i_even_or_odd-0.2.0-py3-none-any.whl (4.1 kB view details)

Uploaded Python 3

File details

Details for the file am_i_even_or_odd-0.2.0.tar.gz.

File metadata

  • Download URL: am_i_even_or_odd-0.2.0.tar.gz
  • Upload date:
  • Size: 4.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for am_i_even_or_odd-0.2.0.tar.gz
Algorithm Hash digest
SHA256 fab10bc446217c9aba1bd8b31b380b7570e9535590a61ccf3929b7a6c75bc5e5
MD5 4ce4d2e72c44f8bcbed50c64574ced9d
BLAKE2b-256 10d76587a2b9b2d6b6cca755a41533aa7aae913f847a4716be5dc61a0b27daa6

See more details on using hashes here.

Provenance

The following attestation bundles were made for am_i_even_or_odd-0.2.0.tar.gz:

Publisher: publish.yml on KenKambi/am-i-even-or-odd

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file am_i_even_or_odd-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for am_i_even_or_odd-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8b55773936e957fdf4170410d56d5894beb6a1fddd451f074aa7d0daadcd9b0a
MD5 7eb2aed1f5d1be93bc8a357be7191173
BLAKE2b-256 f0d798d98dd2f81044fb5dcc3be0d9d49cfcfd84da82649f02b6b73a9bc11650

See more details on using hashes here.

Provenance

The following attestation bundles were made for am_i_even_or_odd-0.2.0-py3-none-any.whl:

Publisher: publish.yml on KenKambi/am-i-even-or-odd

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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