Skip to main content

The simplest calculator library in Python with variable support

Project description

📐 RSC (Really Simple Calculator)

RSC is the simplest calculator library in Python!
It lets you evaluate complex math expressions safely, with support for variables and all basic math operators.

Version: 0.3.2Improved API with setv() and calc()


🔧 Installation

pip install rsc

or

pip install rsc==0.3.2

🚀 Quick Start

import rsc

print(rsc.calc("2 + 3 * (4 - 1)"))  # ➜ 11
print(rsc.calc("5 ^ 2 + 10"))       # ➜ 35

You can also assign variables:

rsc.setv("a", 10)
rsc.setv("b", 20)
rsc.setv("c", 10)

print(rsc.calc("a + b - c"))     # ➜ 20
print(rsc.calc("(a + b) - c"))   # ➜ 20

✅ Supported Features

  • Operators: +, -, *, x, /, //, %, **, ^
  • Parentheses for grouping
  • Variables using setv(name, value)
  • Safe evaluation (using asteval)
  • Simple API

📘 Usage Reference

rsc.calc(expression: str) -> float | str
rsc.setv(name: str, value: float | int)
rsc.show_help()  # Prints usage instructions

🌐 Links


🧠 Author

Made with ❤️ by Rasa8877 RSC — the simplest calculator library in Python!

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

rsc-0.3.2.tar.gz (3.4 kB view details)

Uploaded Source

Built Distribution

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

rsc-0.3.2-py3-none-any.whl (4.2 kB view details)

Uploaded Python 3

File details

Details for the file rsc-0.3.2.tar.gz.

File metadata

  • Download URL: rsc-0.3.2.tar.gz
  • Upload date:
  • Size: 3.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for rsc-0.3.2.tar.gz
Algorithm Hash digest
SHA256 7d940dd4b5c07b054fb43882ef8dec2a237e5e872b749322e9a61c9c41f6a624
MD5 801b1298d4826cfaab4a1bd5d624ce25
BLAKE2b-256 34936c60d92f63c3a88f6d0c5ae123842ef04ba60db7b4b92c591cc814f69551

See more details on using hashes here.

File details

Details for the file rsc-0.3.2-py3-none-any.whl.

File metadata

  • Download URL: rsc-0.3.2-py3-none-any.whl
  • Upload date:
  • Size: 4.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for rsc-0.3.2-py3-none-any.whl
Algorithm Hash digest
SHA256 ed814234a8ff9246e5d487c4ba2d53132e79c44f28e6106544f432a0082e4261
MD5 f9a0f68bb8560f52549aa8f649a8f75c
BLAKE2b-256 afb013583be0f1ad0991488e3d0f653b8e31c13c9abba5a8c571d01f83f7b74c

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