Skip to main content

A small calculator api for Python

Project description

Calculator API for Python

By White Night

Install

# Linux/macOS
python3 -m pip install -U whiteCalculator

# Windows
py -3 -m pip install -U whiteCalculator

QuickStart

>>> from whiteCalculator import Calculator
>>> c = Calculator()
>>> print(c.run("1+8(5^2)"))
201
>>> print(c.run("9Ans"))
1809

Errors

>>> from whiteCalculator import Calculator

>>> c2 = Calculator() # Default is True
>>> c2.run("9/0")
Error: division by zero

>>> c1 = Calculator(skipError=False)
>>> c1.run("9/0")
Traceback (most recent call last):
    ...
ZeroDivisionError: division by zero

Links

GitHub Pypi

You can use:

  • sin / asin / sinh
  • cos / acos / cosh
  • tan / atan / tanh
  • ln / log
  • × / •
  • ^ / ** / power
  • √ / sqrt
  • π / pi
  • %
  • ÷
  • Ans

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

whiteCalculator-0.0.3.tar.gz (4.2 kB view hashes)

Uploaded Source

Built Distribution

whiteCalculator-0.0.3-py3-none-any.whl (5.4 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page