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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file is_42-0.2.0.tar.gz.
File metadata
- Download URL: is_42-0.2.0.tar.gz
- Upload date:
- Size: 23.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2fb154a037706706f7254c01c4697283e3fd47c5adb30c3a55ec125f2a38c110
|
|
| MD5 |
936dd2f39d7ad66581107b4ddb5809bc
|
|
| BLAKE2b-256 |
1f3971ec76499ade15ec2b0d2530bbd8184afbef1ebc0155e09e52a2535b4c8c
|
File details
Details for the file is_42-0.2.0-py3-none-any.whl.
File metadata
- Download URL: is_42-0.2.0-py3-none-any.whl
- Upload date:
- Size: 23.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
579a9e275455881a598e157dee9bd4db56d1af446f817dc92b57865e5332ef8b
|
|
| MD5 |
b2e8c1ce0d1406fd2516bf6fe1f01ff8
|
|
| BLAKE2b-256 |
fb564e39d2954bcc56c37db09aea4f24c61aa0046f2611d30be19da9199801c3
|