Skip to main content

A small calculator module for Python

Project description

Calculator Module for Python

By White Night

PYPI PYPI PYPI GITHUB License GITHUB GITHUB GITHUB GITHUB


Install

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

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

QuickStart

Calculator

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

Formula

from whiteCalculator import Formula
Formula.PythagorasTheorem.getA(b=4, c=5)
# Output: 3
Formula.PythagorasTheorem.getA(b="2^2", c="√(25)")
# Output: 3

Formula List

PythagorasTheorem, LensFormula, LinearMagnificationFormula

DOCS


TODO

  • make Doc
  • more Formula
  • Calculate without eval

Errors

from whiteCalculator import Calculator

c1 = Calculator(skipError=True) # Default is True
c1.run("9/0")
# Output: Error: division by zero

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

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.10.tar.gz (7.3 kB view details)

Uploaded Source

Built Distribution

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

whiteCalculator-0.0.10-py3-none-any.whl (7.5 kB view details)

Uploaded Python 3

File details

Details for the file whiteCalculator-0.0.10.tar.gz.

File metadata

  • Download URL: whiteCalculator-0.0.10.tar.gz
  • Upload date:
  • Size: 7.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.5

File hashes

Hashes for whiteCalculator-0.0.10.tar.gz
Algorithm Hash digest
SHA256 d2bdc9b23993dca8325b42f0625568d0d9af66c35d55dc13c370e698b1e69aae
MD5 4c6b9492a66e472cd477a6456ac46291
BLAKE2b-256 7c612b0d649d90a620ea3d341507e95b7efb553db44ec2f5122adfcd8121618b

See more details on using hashes here.

File details

Details for the file whiteCalculator-0.0.10-py3-none-any.whl.

File metadata

File hashes

Hashes for whiteCalculator-0.0.10-py3-none-any.whl
Algorithm Hash digest
SHA256 819ac46c5a6f51e31c433939b0bbc08893adc4b7fdc8d89d742f2e612d090be8
MD5 a65bcb087cbe1d4ea75a5b59a419736f
BLAKE2b-256 6013c3d756932eccea8d357e2d205dd4b757e55199cb6c021c18c8457f47366e

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