Post

Am I Even or Odd🎲

Am I Even or Odd🎲

Am I Even Or Odd is a small open-source project I built around a very simple question:

Is your number even or odd tho? 😂

Yes, n % 2 == 0 in Python and n % 2 === 0 in JavaScript do exactly what you need.

I wanted to take that simple idea a little further and turn it into proper, installable packages for Python and JavaScript.

🎲 But then there’s --fun

This is where the library gets a little more interesting.

Instead of simply saying even or odd, --fun gives you a random cheeky response.

Run it to see which response you get. Then run it again and get something completely different😂.

🐍 Python

CI Downloads License: MIT

The Python version is available on PyPI and can be installed with:

1
pip install am-i-even-or-odd

It provides simple functions for checking whether an integer is even or odd:

1
2
3
4
from am_i_even_or_odd import is_it_even_tho, is_it_odd_tho

print(is_it_even_tho(4)) //True
print(is_it_odd_tho(5)) //True

It also includes a command-line interface (CLI):

1
2
3
4
5
$ am-i-even-or-odd 42
even

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

⚡ JavaScript

CI NPM Downloads License: MIT

The JavaScript version is published on npm and can be installed with:

1
npm install am-i-even-or-odd

It supports both CommonJS and ESM/TypeScript:

1
2
3
4
import { isItEvenTho, isItOddTho } from 'am-i-even-or-odd';

console.log(isItEvenTho(4)); // true
console.log(isItOddTho(5));  // true

And it also includes a command-line interface (CLI):

1
2
3
4
5
$ npx am-i-even-or-odd 42
even

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

Both versions also include input validation, automated testing, CI, CLI support, and the same MIT open-source license.

The project was less about solving a difficult programming problem and more about learning what goes into turning a tiny piece of code into an actual software package that other developers can install and use.

Through the project, I got to experiment with Python packaging and PyPI, npm publishing, CLI development, testing, CI/CD, error handling, and open-source project structure.

And honestly, there’s something funny about building an entire library for something that can be written as:

1
number % 2 😂

Sometimes the smallest projects are the best way to learn.

🐍 Python — PyPI ⚡ JavaScript — npm 💻 Python — GitHub 💻 JavaScript — GitHub

🗂️ LinkedIn

This post is licensed under CC BY 4.0 by the author.