Skip to main content

A library to check if a number is seven

Project description

is-seven

A simple yet powerful Python library that solves one of programming's most critical challenges: determining if a number is seven. 🔢 This library provides a robust, production-ready solution for the common programming task of seven detection and validation.

Why is-seven?

Have you ever needed to check if a number is exactly seven? 🤔 Of course you have! While it may seem trivial to write number == 7, using a dedicated library brings several benefits: ✨

The is-seven library offers numerous compelling advantages that make it the ideal choice for your seven-detection needs:

  • Professionally tested and maintained code with comprehensive unit tests ✅ - Every release undergoes rigorous testing across multiple Python versions and platforms to ensure consistent behavior and reliability. Our test suite covers edge cases and validates core functionality.

  • Clear, semantic API that documents your intent and improves code readability 📚 - The simple, expressive API makes code self-documenting. When other developers see is_seven() they immediately understand the validation being performed.

  • Handles edge cases like strings and floating point numbers 🎯 - Beyond basic integer comparison, is-seven properly handles floating point precision, string parsing, and gracefully manages invalid inputs. No need to write your own type checking and conversion logic.

  • Zero dependencies - lightweight and reliable 🪶 - The library has absolutely no external dependencies, making it extremely lightweight and eliminating potential compatibility issues or security vulnerabilities from third-party packages.

  • Documentation with clear examples 📚 - Comprehensive documentation with usage examples helps you get started quickly. Code snippets demonstrate common use cases and proper implementation.

  • Cross-platform compatibility - works on Windows, Mac, Linux 💻 - Extensively tested across all major operating systems to guarantee consistent behavior regardless of platform. Deploy with confidence knowing it will work everywhere.

  • Production-ready with semantic versioning 📦 - Following semantic versioning ensures API stability and makes dependency management predictable. Breaking changes are clearly communicated through version numbers.

  • MIT licensed for maximum flexibility ⚖️ - The permissive MIT license allows usage in both commercial and open source projects with minimal restrictions. You can freely use, modify and distribute the code.

Key Features

The library provides a focused set of powerful features:

  • Simple, intuitive API that does one thing well 🎯 - A single function with clear purpose and behavior makes the library easy to learn and use effectively. No complicated configuration or setup required.

  • Handles integers, floats and strings 🔢 - Flexible input handling accepts multiple numeric types including integers, floating point numbers, and their string representations. No need for manual type conversion.

  • String parsing for numeric values ("7") 📝 - Intelligent string parsing converts numeric strings like "7" to their corresponding number for comparison. Handles leading/trailing whitespace and invalid formats gracefully.

  • Direct equality comparison for numbers 🎯 - Performs exact numeric equality comparison accounting for type and value. No fuzzy matching or approximate comparisons that could produce incorrect results.

  • Comprehensive test suite ensuring reliability ✅ - Extensive unit tests verify behavior across input types, edge cases, and error conditions. High test coverage gives confidence in library stability.

  • Well-documented source code 📚 - Clean, documented implementation makes it easy to understand how the library works. Docstrings and comments explain the logic and design decisions.

Installation

You can install is_seven using pip:

pip install is-seven

Usage

Basic usage is extremely straightforward:

from is_seven import is_seven

# Returns True
print(is_seven(7))
print(is_seven(7.0))
print(is_seven("7"))

# Returns False
print(is_seven(8))
print(is_seven(-7))
print(is_seven("eight"))
print(is_seven("7.1"))
print(is_seven(None))

API Reference

is_seven(value)

Returns True if the input is seven, False otherwise.

Parameters:

  • value: The value to test. Can be:
    • Integer
    • Float
    • String (will attempt conversion)

Returns:

  • bool: True if seven, False otherwise

Contributing

Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

MIT

FAQ

Q: Why not just use ==?
A: While == works for simple cases, is_seven() handles edge cases and provides semantic clarity to your code.

Q: What's next for is_seven?
A: We're considering adding support for:

  • Roman numeral VII
  • Base-7 representations
  • Semantic sevenness detection
  • Cloud-native seven validation
  • Blockchain integration

Acknowledgements

Special thanks to the number 7 for being consistently seven throughout this project's development.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

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

is_seven-0.1.0-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

Details for the file is_seven-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: is_seven-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 5.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 colorama/0.4.4 importlib-metadata/4.6.4 keyring/23.5.0 pkginfo/1.8.2 readme-renderer/34.0 requests-toolbelt/0.9.1 requests/2.25.1 rfc3986/1.5.0 tqdm/4.57.0 urllib3/1.26.5 CPython/3.10.12

File hashes

Hashes for is_seven-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a51b52d81451f3fe353eaf4ca3406841d3d7a9fb79fa5d33c35901a9c0318de8
MD5 0600e263659a83477eb2dec0c6385d56
BLAKE2b-256 afd017a0049da6ef80867064e093a54fb5d45bc7cd0515b08e9fd16906b3bd4c

See more details on using hashes here.

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