Hey everyone! 👋
I wanted to share some exciting news about my Python calculator library. After some thought and feedback, I decided to rename and simplify the package from rs-calculator
to just rsc
. The goal? To make it as clean and easy to use as possible!
Why the change?
The old name rs-calculator
was a bit long and sometimes confusing to type or remember. By switching to rsc
, the library gets a fresh, short, and memorable name — perfect for quick imports and smoother development.
What does rsc
offer?
If you’re new to this library, here’s a quick rundown:
- 🧮 Calculate expressions with ease using the
calculate()
function - 📌 Assign variables with
assign_var()
and use them in calculations - 🔢 Supports common operators like
+
,-
,*
,/
,//
,%
,**
, and^
- 🧩 Handles parentheses for grouping complex expressions
- 🔒 Uses safe evaluation under the hood (with the
asteval
package) so you don’t have to worry about security - 🎯 Simple API designed to get you calculating fast
How do you use it?
Here’s a quick example to get you started:
import rsc print(rsc.calculate("2 + 3 * (4 - 1)")) # Output: 11 print(rsc.calculate("5 ^ 2 + 10")) # Output: 35 # Assign variables rsc.assign_var("a", 10) rsc.assign_var("b", 20) rsc.assign_var("c", 10) # Use variables in calculations print(rsc.calculate("a + b - c")) # Output: 20 print(rsc.calculate("(a + b) - c")) # Output: 20
How to install?
Just run this in your terminal:
pip install rsc
A little about the package
I believe rsc
might be the simplest calculator library in Python with variable support — perfect for beginners, students, or anyone who needs a lightweight tool for quick math.
The library is designed with simplicity and safety in mind, so you can trust it in your projects without worrying about complex setup or security risks.
Where to find it?
You can check out the project on PyPI here to see the latest versions, docs, and more.
What’s next?
I’m always open to feedback and contributions! If you have ideas or find bugs, please feel free to open an issue or submit a pull request on the GitHub repo (link in the PyPI page).
Thanks for reading, and happy calculating! ✨
— Your friendly calculator dev 🚀
Let me know if you want it adjusted in any way!
Email: letperhut@gmail.com
Top comments (0)