Skip to content

cstmth/is_even

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 

Repository files navigation

is_even — Deterministic Even Number Evaluation in Python

Python License: MIT Build Coverage Status Contributions Platform Code Style Tested On Issues Forks Stars Last Commit Repo Size Lines of Code


Overview

The is_even repository provides a clear and direct implementation of even-number classification within a bounded integer range (0–30).
This implementation uses a deterministic sequence of conditional evaluations to determine whether a given integer value is even.

The project follows a strict design standard prioritizing explicitness, predictability, and readability over abstraction or optimization.


Features

  • Evaluates integer parity for values in the range 0–30.
  • Returns True for even integers and False for odd integers.
  • Operates deterministically with a fixed number of conditional branches.
  • Implements no loops, recursion, or mathematical operators beyond comparison and equality checks.
  • Fully self-contained, requiring no external dependencies.

Function Interface

Definition

def is_even(n: int) -> bool | None

Parameters

Parameter Type Description
n int An integer input within the range of 0 to 30.

Returns

Return Value Type Description
True bool Returned when n is an even integer between 0 and 30.
False bool Returned when n is an odd integer between 0 and 30.
None NoneType Returned when n exceeds the defined operational range (greater than 30).

Repository Structure

is_even/
├── is_even.py          # Primary module containing function definition
├── README.md           # Documentation for the repository
└── LICENSE             # Project license (The Unlicense)

Usage

Command-Line Execution

Example command to execute through a terminal:

python3 is_even.py 10

Expected Output:

True

Example with an odd integer:

python3 is_even.py 9

Expected Output:

False

Programmatic Usage

You may import and use the function directly in another Python script:

from is_even import is_even

result = is_even(12)
print(result)

Output:

True

Implementation Detail

The current implementation enumerates all accepted integer inputs (0–30) through individual equality checks.
This design is intentional to minimize implicit logic and improve traceability of control flow during debugging or auditing.

Each condition explicitly binds an integer literal to its corresponding parity classification.
The structure maintains a direct mapping between input and output states without abstraction or mathematical operators.


Design Principles

  1. Determinism
    Every input in the supported range produces a single, predetermined output.

  2. Traceability
    Each conditional branch corresponds directly to one integer value, ensuring high transparency.

  3. Explicitness
    The design forgoes expressions using modulo or bitwise operators in favor of individually stated conditions.

  4. Limited Scope
    The function’s current design covers integers from 0 through 30.
    Values outside this scope are not processed and yield a None response.


Performance Considerations

Criterion Value Explanation
Time Complexity O(1) The function executes a constant number of condition checks (≤ 31).
Space Complexity O(1) No auxiliary data structures are allocated.
Determinism Absolute Every valid input has one defined and observable output.

Extensibility

Future versions may include:

  • Extended input range beyond 30
  • Parametric evaluation to define variable range
  • Replacement with structural pattern matching for higher maintainability
  • Integration with continuous testing and type enforcement tools

Versioning

This project follows Semantic Versioning 2.0.0.
The initial implementation corresponds to version v1.0.0.


Contribution Guidelines

Contributions are welcome under the following standards:

  • All pull requests must maintain deterministic parity logic.
  • No loops, list comprehensions, or mathematical operations may be introduced without justification.
  • Code must adhere to PEP 8.
  • Each new input-range extension must include separate and explicit conditional statements.

To begin contributing:

git clone https://github.com/yourusername/is_even.git
cd is_even

License

This project is distributed under The Unlicense.
See the LICENSE file for detailed terms and conditions.


Acknowledgements

This implementation adheres to best practices for explicit and deterministic function design within bounded numerical ranges.
It demonstrates a reference-level approach to traceable logic in Python-based computation systems.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages