Skip to main content

Expression Calculator

Python Version PyPI Version License: MIT

A secure mathematical expression evaluator with lexical analysis that doesn't use unsafe eval()

Key Features

✅ Safe parsing - No dangerous eval() usage
✅ Parentheses and operator precedence support
✅ Integer and floating-point arithmetic
✅ Detailed error reporting
✅ Clean modular architecture

Installation

pip install expression_calculator

Usage

from expression_calculator import Calculator

calc = Calculator()
result = calc.calculate("(5 + 3) * 2 - 10 / 2")  # Returns 11.0
print(f"Result: {result}")

Supported Operations

Operator Example
plus + 2 + 3 + 2
minus - 8 - 3 - 2
multiply * 9 * 5 * 2
divide / 6 / 2 / 1.4
parens () 5 + (3 * 2)

Credits

🖥 - Discord: @exityxdev 📱 - Telegram: @exityx

Thanks You! ❤

Metadata

Release files for expression-calculator 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for expression-calculator 0.1.0
File Size Uploaded
expression_calculator-0.1.0.tar.gz 3.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for expression-calculator 0.1.0
File Interpreter ABI Platform
expression_calculator-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 7.0 kB

Release files / expression_calculator-0.1.0.tar.gz

Download URL expression_calculator-0.1.0.tar.gz
Size 3.2 kB
Tags Source
SHA-256 checksum
How to use checksums
944273051288f429e156bf1832b21316fb230b39d180a61029f847094e982d26
BLAKE2b-256 checksum
How to use checksums
e1c48d1fb138a677c1f282b80dcd5dbabcb05fd41307c2a420be0c66b257b693
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.3

Release files / expression_calculator-0.1.0-py3-none-any.whl

Download URL expression_calculator-0.1.0-py3-none-any.whl
Size 3.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bc6a5caa61c567e694331afad17fe3fab40bc6c21c083621bf43b312a1864637
BLAKE2b-256 checksum
How to use checksums
877c054711dbc9db7146d7b3ad747edef0f53500cbb9f647208ee075398e7e97
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.3

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page