Skip to main content

Is your number even or odd tho?

Project description

Am I Even Or Odd

PyPI version CI Python versions License: MIT

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'.

Command line

Installing the package also gives you a CLI:

$ am-i-even-or-odd 42
even

$ am-i-even-or-odd 7 --fun
7 is even! Kidding it's obviously ODD.

--fun swaps the plain even/odd output for a random one-liner with a bit more personality. Invalid input (non-integers) prints a usage error and exits with a non-zero status code, so it plays nice in scripts.

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.3.0.tar.gz (5.4 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.3.0-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: am_i_even_or_odd-0.3.0.tar.gz
  • Upload date:
  • Size: 5.4 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.3.0.tar.gz
Algorithm Hash digest
SHA256 4b8ba1e999b99c53df094fd029d85162cbfd6aeb17949d5b2b2cc36356e23b4f
MD5 24f4e0676b688549c69d28a3be45e9c3
BLAKE2b-256 e12ee9d0ecd54a1d3d56ffbc76cb12e9e3b7fa409b9386b1062a61f4e9386e37

See more details on using hashes here.

Provenance

The following attestation bundles were made for am_i_even_or_odd-0.3.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.3.0-py3-none-any.whl.

File metadata

File hashes

Hashes for am_i_even_or_odd-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7bcf51ffaa2354e6834a0398462bf50717603f98e2d26b6aaad7f5c33daa1e46
MD5 e2b4daff361921d635b61786d2e0c452
BLAKE2b-256 4b6e8711b0c13c9036328d5ebf15fec4fac1b170302d8749eb1d2cfdfaa2373e

See more details on using hashes here.

Provenance

The following attestation bundles were made for am_i_even_or_odd-0.3.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