Skip to main content

The ultimate answer detection package. Detects 42 in any conceivable form.

Project description

is-42 🌌

"The Answer to the Ultimate Question of Life, the Universe, and Everything." — Deep Thought

The ultimate answer detection package. Detects the number 42 in any conceivable form — across 30+ languages, number systems, math expressions, cultural references, and more.

Zero dependencies. Pure Python. Pure wisdom.

Installation

pip install is-42

Quick Start

from is_42 import is_42, why_42

# === Numeric ===
is_42(42)          # True
is_42(42.0)        # True
is_42(42 + 0j)     # True

# === Multilingual (30+ languages) ===
is_42("四十二")      # True  (Chinese)
is_42("forty-two")  # True  (English)
is_42("four two")   # True  (English informal)
is_42("quarante-deux")  # True  (French)
is_42("zweiundvierzig") # True  (German)
is_42("сорок два")      # True  (Russian)
is_42("よんじゅうに")     # True  (Japanese)
is_42("사십이")          # True  (Korean)

# === Roman Numerals ===
is_42("XLII")     # True
is_42("xlii")     # True

# === Math Expressions (safe sandbox, no eval!) ===
is_42("6 * 7")                  # True
is_42("(122*381+6)**0 + 41")    # True
is_42("2^5 + 10")               # True

# === Base Conversions ===
is_42("0b101010")   # True  (binary)
is_42("0o52")       # True  (octal)
is_42("0x2A")       # True  (hex)
is_42("4.2e1")      # True  (scientific)
is_42("42")        # True  (full-width)
is_42("④②")         # True  (circled digits)

# === Cultural References ===
is_42("The Answer to Life, the Universe, and Everything")  # True
is_42("Deep Thought")    # True
is_42("Don't Panic")     # True

# === Creative ===
is_42("!" * 42)          # True  (42 identical characters)
is_42("....- ..---")     # True  (Morse code for 42)

# === Not 42? ===
is_42(43)            # False
is_42("hello")       # False

why_42() — The Explanation Function

>>> why_42("XLII")
'Roman numeral: XLII = XLII = 42'

>>> why_42("6 * 7")
'math expression: 6 * 7 = 42'

>>> why_42("Deep Thought")
'cultural reference: Douglas Adams — Deep Thought (the supercomputer that computed 42)'

>>> why_42(43)
None

Supported Detection Methods

Category Examples
🔢 Numeric 42, 42.0, 42+0j, Decimal("42"), Fraction(84,2)
🌍 Multilingual 30+ languages: Chinese, English, French, German, Japanese, Korean, Russian, Arabic, Hindi, ...
🏛️ Roman XLII, Unicode Roman characters
🧮 Math 6*7, 2^5+10, (122*381+6)**0+41
💻 Bases Binary 0b101010, Octal 0o52, Hex 0x2A, Scientific 4.2e1
🎭 Encoding Full-width 42, Circled ④②, Thai ๔โ, Arabic-Indic ٤٢
🌌 Cultural "The Answer to Life...", "Deep Thought", "Don't Panic"
🎨 Creative 42 identical chars, Morse code ....- ..---, Tally marks

License

MIT © is-42 contributors

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

is_42-0.1.0.tar.gz (16.9 kB view details)

Uploaded Source

Built Distribution

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

is_42-0.1.0-py3-none-any.whl (16.7 kB view details)

Uploaded Python 3

File details

Details for the file is_42-0.1.0.tar.gz.

File metadata

  • Download URL: is_42-0.1.0.tar.gz
  • Upload date:
  • Size: 16.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for is_42-0.1.0.tar.gz
Algorithm Hash digest
SHA256 b53194bf4d84b85782d5a6456298483f803ff173cb75006d68dae8608270b316
MD5 dec792825e866d03a523b8bd65f79aa6
BLAKE2b-256 f1152f8e0515a2baa656401e17b331a65fb1610aa8bde2e07fbd75fbfbcb91b8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: is_42-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 16.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for is_42-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b69a16267073bfeda375d992d667454897e5a881704a4050192bbe6f0a0dffee
MD5 30684a81e337910017a7e44d551f44a8
BLAKE2b-256 fb7251ee87c4b7a56875c7976e9f8ea40c061afe2f5f9d363d8be03df616e091

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