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.2.4Fixed the bugs


🔧 Installation

pip install rsc

or

pip install rsc==0.2.4

🚀 Quick Start

import rsc

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

You can also assign variables:

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

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

✅ Supported Features

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

📘 Usage Reference

rsc.calculate(expression: str) -> float | str
rsc.assign_var(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.2.4.tar.gz (3.6 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.2.4-py3-none-any.whl (4.2 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for rsc-0.2.4.tar.gz
Algorithm Hash digest
SHA256 e2c285d58042b4a6e39e16a2820c66c74b1787fd52208d5d999b5cc03caab7c4
MD5 930a3c1172e6c27656718f4c11fccc63
BLAKE2b-256 4ef1aab65dc63edf8eab86b9cbfab9dc1af4a13fbc053ee9293d745eafd545bf

See more details on using hashes here.

File details

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

File metadata

  • Download URL: rsc-0.2.4-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.0

File hashes

Hashes for rsc-0.2.4-py3-none-any.whl
Algorithm Hash digest
SHA256 f70bcec6db5a9d733c18eb1f625341c3a65bd68e70d8802ee6aa5affc32ae6e0
MD5 69c81cbd4699dc3fcd82dd3bb4a9f524
BLAKE2b-256 6ec521b34897e384f97b7561661256e084aa092acd3f7d42c5c6d58649dffeea

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