Skip to content
/ pycalc Public

Recursive descent parsing implementation in pure python.

Notifications You must be signed in to change notification settings

awtb/pycalc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

64 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PyCalc

PyCalc is a versatile calculator library and command-line tool written in Python. It supports basic arithmetic operations and essential mathematical functions, making it a handy tool for quick calculations or a reusable library for your Python projects.

Features

  • Basic Operators: Addition (+), Subtraction (-), Multiplication (*), Division (/), Power (pow)
  • Mathematical Functions: Square root (sqrt), Sine (sin), Cosine (cos), Tangent (tan), Arctangent (atan)
  • Command-Line Interface: Perform calculations directly from your terminal
  • Library Integration: Import PyCalc into your Python code for seamless computation

Installation

pip install git+https://github.com/awtb/pycalc

Usage

Using command-line interface

python -m pycalc --expression 2 + 2 / 4

Want a REPL?

python -m pycalc

Using programming interface

from pycalc.calculator import calc

expression = "2 + 4 / 2"
result = calc(expression)

print(result)

Run tests

poetry run pytest

About

Recursive descent parsing implementation in pure python.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages