CalcuPy 📚 Create console-based calculators in a few lines of code.

Overview

CalcuPy 📚

Create console-based calculators in a few lines of code.

📌 Installation

pip install calcupy

📌 Usage

from calcupy import Calculator

calculator = Calculator()
calculator.start()

📌 Calculator parameters

Calculator have four parameters:

Calculator(number_variables, function_variables, title, bullet)

📍 number_variables:

GRAVITY = 9.8
SPEED = 20

number_variables = {"g": GRAVITY, "v": SPEED}
calculator = Calculator(number_variables)
calculator.start()

If we run the calculator:

$ g
9.8

$ v
20

$ v + g * 0.01
20.098

📍 function_variables:

def factorial(n):
    if n == 0 or n == 1:
        return 1
    return n * factorial(n - 1)


def y(x1, x2):
    return (x1 + 2) * x2


function_variables = {"y": y, "fac": factorial}
calculator = Calculator(None, function_variables)
calculator.start()

If we run the calculator:

$ fac(4)
24

$ y(2.4, 5.1)
22.44

$ fac(3) + y(2.4, 5.1)
28.44

📍 Basic example:

def foo(x, y):
    return x * y ** 2


title = "MY CALCULATOR"
bullet = "->"
number_variables = {"x": 2, "y": 3}
function_variables = {"foo": foo}
calculator = Calculator(number_variables, function_variables, title, bullet)
calculator.start()

If we run the calculator:

MY CALCULATOR

-> foo(2, 3)
18

-> foo(x, y) * 2
36

-> x / 8 * y
0.75

📌 Commands

📍 ADD

Description:

ADD command let you dynamically add new numeric variables.

Syntax:

add identifier expression

Example:

$ add x 4

$ add y 3

$ x * y
12

You can also assign an arithmetic expression to a variable. This expression is solved and the result is stored in the specified identifier.

$ add x sqrt(5) * tan(8 * 2) / 5

$ x
0.1344468258787234

📍 REMOVE

Description:

REMOVE command let you dynamically remove numeric variables.

Syntax:

remove identifier

Example:

$ add x 4.2

$ x
4.2

$ remove x

$ x
Error: 'NoneType' object is not subscriptable
You might also like...
Simplified diarization pipeline using some pretrained models - audio file to diarized segments in a few lines of code
Simplified diarization pipeline using some pretrained models - audio file to diarized segments in a few lines of code

simple_diarizer Simplified diarization pipeline using some pretrained models. Made to be a simple as possible to go from an input audio file to diariz

Authenticate your League of legends account on riot client in a few lines of code.

lol-authenticator v1.0.0 Content index Project Setup Dependencies Project Setup Dependencies Python v3.9.6 If you don't have Python installed on your

Python wrapper class for OpenVINO Model Server. User can submit inference request to OVMS with just a few lines of code

Python wrapper class for OpenVINO Model Server. User can submit inference request to OVMS with just a few lines of code.

Create Data & AI apps in 20 lines of code with Shimoku

Install with: pip install shimoku-api-python Start with: from os import getenv import shimoku_api_python.client as Shimoku

sequitur is a library that lets you create and train an autoencoder for sequential data in just two lines of code
sequitur is a library that lets you create and train an autoencoder for sequential data in just two lines of code

sequitur sequitur is a library that lets you create and train an autoencoder for sequential data in just two lines of code. It implements three differ

This is discord nitro code generator and checker made with python. This will generate nitro codes and checks if the code is valid or not. If code is valid then it will print the code leaving 2 lines and if not then it will print '*'.

Discord Nitro Generator And Checker ⚙️ Rᴜɴ Oɴ Rᴇᴘʟɪᴛ 🛠️ Lᴀɴɢᴜᴀɢᴇs Aɴᴅ Tᴏᴏʟs If you are taking code from this repository without a fork, then atleast

Code for T-Few from "Few-Shot Parameter-Efficient Fine-Tuning is Better and Cheaper than In-Context Learning"

T-Few This repository contains the official code for the paper: "Few-Shot Parameter-Efficient Fine-Tuning is Better and Cheaper than In-Context Learni

Mini is a web browser application based on the Python PyQt web engine, made in 290 lines of code.
Mini is a web browser application based on the Python PyQt web engine, made in 290 lines of code.

Mini Mini is a web browser application based on the Python PyQt web engine, made in 290 lines of code. The code is written and published as is, so the

A simple, console based nHentai Code Generator

nHentai Code Generator A simple, console based nHentai Code Generator. How to run? Windows Android Windows Make sure you have python and git installed

 Few-NERD: Not Only a Few-shot NER Dataset
Few-NERD: Not Only a Few-shot NER Dataset

Few-NERD: Not Only a Few-shot NER Dataset This is the source code of the ACL-IJCNLP 2021 paper: Few-NERD: A Few-shot Named Entity Recognition Dataset.

A Planar RGB-D SLAM which utilizes Manhattan World structure to provide optimal camera pose trajectory while also providing a sparse reconstruction containing points, lines and planes, and a dense surfel-based reconstruction.
A Planar RGB-D SLAM which utilizes Manhattan World structure to provide optimal camera pose trajectory while also providing a sparse reconstruction containing points, lines and planes, and a dense surfel-based reconstruction.

ManhattanSLAM Authors: Raza Yunus, Yanyan Li and Federico Tombari ManhattanSLAM is a real-time SLAM library for RGB-D cameras that computes the camera

Raspberry Pi Based Serial Console Server, with PushBullet Notification of IP changes, Automatic VPN termination, custom menu, Power Outlet Control, and a lot more
Raspberry Pi Based Serial Console Server, with PushBullet Notification of IP changes, Automatic VPN termination, custom menu, Power Outlet Control, and a lot more

ConsolePi Acts as a serial Console Server, allowing you to remotely connect to ConsolePi via Telnet/SSH/bluetooth to gain Console Access to devices co

Todo list console based application. Todo's save to a seperate file.

Todo list console based application. Todo's save to a seperate file.

Serverless console based chat program made with PyDrive2.
Serverless console based chat program made with PyDrive2.

Nautilus Serverless console based chat program made with PyDrive2. How To Use: After installing the program files from GitHub, they can be put anywher

Deploy a ML inference service on a budget in less than 10 lines of code.
Deploy a ML inference service on a budget in less than 10 lines of code.

BudgetML is perfect for practitioners who would like to quickly deploy their models to an endpoint, but not waste a lot of time, money, and effort trying to figure out how to do this end-to-end.

Fine-Tune EleutherAI GPT-Neo to Generate Netflix Movie Descriptions in Only 47 Lines of Code Using Hugginface And DeepSpeed
Fine-Tune EleutherAI GPT-Neo to Generate Netflix Movie Descriptions in Only 47 Lines of Code Using Hugginface And DeepSpeed

GPT-Neo-2.7B Fine-Tuning Example Using HuggingFace & DeepSpeed Installation cd venv/bin ./pip install -r ../../requirements.txt ./pip install deepspe

Py_extract is a simple, light-weight python library to handle some extraction tasks using less lines of code

py_extract Py_extract is a simple, light-weight python library to handle some extraction tasks using less lines of code. Still in Development Stage! I

This is a Python program I wrote to simulate the solar system with 79 lines of code.
This is a Python program I wrote to simulate the solar system with 79 lines of code.

Solar System With Python This is a Python program I wrote to simulate the solar system with 79 lines of code. Required modules tkinter, math, time Why

Owner
Dylan Tintenfich
:books: Systems engineering student at Universidad Tecnológica Nacional Mendoza.
Dylan Tintenfich
A cross platform package to do curses-like operations, plus higher level APIs and widgets to create text UIs and ASCII art animations

ASCIIMATICS Asciimatics is a package to help people create full-screen text UIs (from interactive forms to ASCII animations) on any platform. It is li

null 3.2k Jan 9, 2023
Cleo allows you to create beautiful and testable command-line interfaces.

Cleo Create beautiful and testable command-line interfaces. Cleo is mostly a higher level wrapper for CliKit, so a lot of the components and utilities

Sébastien Eustace 984 Jan 2, 2023
Typer, build great CLIs. Easy to code. Based on Python type hints.

Typer, build great CLIs. Easy to code. Based on Python type hints. Documentation: https://typer.tiangolo.com Source Code: https://github.com/tiangolo/

Sebastián Ramírez 10.1k Jan 2, 2023
Command line animations based on the state of the system

shell-emotions Command line animations based on the state of the system for Linux or Windows 10 The ascii animations were created using a modified ver

Simon Malave 63 Nov 12, 2022
Calculatrix is a project where I'll create plenty of calculators in a lot of differents languages

Calculatrix What is Calculatrix ? Calculatrix is a project where I'll create plenty of calculators in a lot of differents languages. I know this sound

null 1 Jun 14, 2022
Deskew is a command line tool for deskewing scanned text documents. It uses Hough transform to detect "text lines" in the image. As an output, you get an image rotated so that the lines are horizontal.

Deskew by Marek Mauder https://galfar.vevb.net/deskew https://github.com/galfar/deskew v1.30 2019-06-07 Overview Deskew is a command line tool for des

Marek Mauder 127 Dec 3, 2022
Dahua Console, access internal debug console and/or other researched functions in Dahua devices.

Dahua Console, access internal debug console and/or other researched functions in Dahua devices.

bashis 156 Dec 28, 2022
Easily train your own text-generating neural network of any size and complexity on any text dataset with a few lines of code.

textgenrnn Easily train your own text-generating neural network of any size and complexity on any text dataset with a few lines of code, or quickly tr

Max Woolf 4.8k Dec 30, 2022
Easily train your own text-generating neural network of any size and complexity on any text dataset with a few lines of code.

textgenrnn Easily train your own text-generating neural network of any size and complexity on any text dataset with a few lines of code, or quickly tr

Max Woolf 4.3k Feb 18, 2021
SparseML is a libraries for applying sparsification recipes to neural networks with a few lines of code, enabling faster and smaller models

SparseML is a toolkit that includes APIs, CLIs, scripts and libraries that apply state-of-the-art sparsification algorithms such as pruning and quantization to any neural network. General, recipe-driven approaches built around these algorithms enable the simplification of creating faster and smaller models for the ML performance community at large.

Neural Magic 1.5k Dec 30, 2022