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.2 – Improved 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
- GitHub Repo
- Contact: letperhut@gmail.com
🧠 Author
Made with ❤️ by Rasa8877 RSC — the simplest calculator library in Python!
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7d940dd4b5c07b054fb43882ef8dec2a237e5e872b749322e9a61c9c41f6a624
|
|
| MD5 |
801b1298d4826cfaab4a1bd5d624ce25
|
|
| BLAKE2b-256 |
34936c60d92f63c3a88f6d0c5ae123842ef04ba60db7b4b92c591cc814f69551
|
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ed814234a8ff9246e5d487c4ba2d53132e79c44f28e6106544f432a0082e4261
|
|
| MD5 |
f9a0f68bb8560f52549aa8f649a8f75c
|
|
| BLAKE2b-256 |
afb013583be0f1ad0991488e3d0f653b8e31c13c9abba5a8c571d01f83f7b74c
|