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.
- Evaluates integer parity for values in the range 0–30.
- Returns
Truefor even integers andFalsefor 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.
def is_even(n: int) -> bool | None| Parameter | Type | Description |
|---|---|---|
n |
int |
An integer input within the range of 0 to 30. |
| 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). |
is_even/
├── is_even.py # Primary module containing function definition
├── README.md # Documentation for the repository
└── LICENSE # Project license (The Unlicense)
Example command to execute through a terminal:
python3 is_even.py 10Expected Output:
True
Example with an odd integer:
python3 is_even.py 9Expected Output:
False
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
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.
-
Determinism
Every input in the supported range produces a single, predetermined output. -
Traceability
Each conditional branch corresponds directly to one integer value, ensuring high transparency. -
Explicitness
The design forgoes expressions using modulo or bitwise operators in favor of individually stated conditions. -
Limited Scope
The function’s current design covers integers from0through30.
Values outside this scope are not processed and yield aNoneresponse.
| 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. |
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
This project follows Semantic Versioning 2.0.0.
The initial implementation corresponds to version v1.0.0.
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_evenThis project is distributed under The Unlicense.
See the LICENSE file for detailed terms and conditions.
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.