Simple expression calculator with safe evaluation
Project description
Expression Calculator
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! ❤
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 expression_calculator-0.1.0.tar.gz.
File metadata
- Download URL: expression_calculator-0.1.0.tar.gz
- Upload date:
- Size: 3.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
944273051288f429e156bf1832b21316fb230b39d180a61029f847094e982d26
|
|
| MD5 |
eadda0bf43f34243a883e4e6bb90c489
|
|
| BLAKE2b-256 |
e1c48d1fb138a677c1f282b80dcd5dbabcb05fd41307c2a420be0c66b257b693
|
File details
Details for the file expression_calculator-0.1.0-py3-none-any.whl.
File metadata
- Download URL: expression_calculator-0.1.0-py3-none-any.whl
- Upload date:
- Size: 3.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bc6a5caa61c567e694331afad17fe3fab40bc6c21c083621bf43b312a1864637
|
|
| MD5 |
57cde5906a404b2578102af1e8528eb4
|
|
| BLAKE2b-256 |
877c054711dbc9db7146d7b3ad747edef0f53500cbb9f647208ee075398e7e97
|