A small calculator module for Python
Project description
Calculator Module for Python
By White Night
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)"))
201
>>> print(c.run("9Ans"))
1809
Formula
>>> from whiteCalculator import Formula
>>> Formula.PythagorasTheorem.getA(b=4, c=5)
3
>>> Formula.PythagorasTheorem.getA(b="2^2", c="√(25)")
3
Formula List
Pythagoras Theorem
, Lens Formula
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
You can use:
sin
/asin
/sinh
cos
/acos
/cosh
tan
/atan
/tanh
ln
/log
×
/•
^
/ **
/power
√
/sqrt
π
/pi
%
÷
Ans
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
whiteCalculator-0.0.5.tar.gz
(6.1 kB
view hashes)
Built Distribution
Close
Hashes for whiteCalculator-0.0.5-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b4d26de69b1a1d159e645963c1c2f282a25739301d5c5c141b915b019c9847d0 |
|
MD5 | 0eb3485fa3d53a24835da7f8d98fe0c9 |
|
BLAKE2b-256 | 39fd1266617b24a301b948f22a1d6363a7044dff6d9f1da26db4b8eb051a0762 |