Skip to main content

A customizable Python calculator with user-defined operators and constants.

Project description

CustomCalc A small, customizable calculator for Python that lets you define your own operators, constants, and functions. Uses NumPy for math operations.

Install: pip install customcalc

Example:

from customcalc import build_basic_calc
# default operators/expressions
calc = build_basic_calc()
print(calc.calculate("1 + 2 * 3")) # 7
print(calc.calculate("cos(pi / 3)")) # 0.5
print(calc.calculate("3! + 4")) # 10

# Custom operator example:
from customcalc import CalculatorBuilder
import numpy as np

b = CalculatorBuilder()

b.addBinaryOperator("plus", 0, np.add)
b.addConstant("one", 1)
b.addConstant("two", 2)

calc = b.build()
print(calc.calculate("one plus two")) # equals three

License: MIT

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

customcalc-0.1.0.tar.gz (8.2 kB view details)

Uploaded Source

Built Distribution

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

customcalc-0.1.0-py3-none-any.whl (8.7 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for customcalc-0.1.0.tar.gz
Algorithm Hash digest
SHA256 f2430cdc511e9f003d6271591018e55fd23e99a69f16b7445c091b2f3eed27b7
MD5 2108f1681afef0afbf60659685d6f94f
BLAKE2b-256 125ce076a56ca8453845428d41e3ef0e16cc444c96eb8892146ee6ae5282df29

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for customcalc-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d098b6f3960bc08f6c02170bd7428534550dfd7b0754b6fc214284f14b9b5a9f
MD5 a03ba1dd3456c47bfb7e868131ac8137
BLAKE2b-256 2d4bd30799656cd175de602e8fa595a8f56bac12e56bf3042437c5c92a65b9c2

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