Skip to content

aizethara/calculator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Calculator

A powerful console-based calculator written in Python. Supports basic arithmetic, bitwise logic, trigonometry, statistics, cryptographic hashing, base conversions, combinatorics, and secure lambda-based evaluation engine.


Features:

  • All functions are accessible through intuitive symbols

  • Includes 36 operations

  • Allows safe evaluation of custom expressions with lambda

  • Colored output for better readability

To display the general help, just enter ? during calculator use.

Requirements

pip install colorama

How to run

Open a terminal in the project folder and run:

python main.py

Operations

Key Function Example Expression
+ Addition 2 + 3
- Subtract 10 - 4
* Multiply 6 * 9
/ Divide 20 / 5
^ Power 2 ** 3
r Root 16 ** (1/2) for √16
% Percent of (20 / 100) * 200
m Modulo 10 % 3
l Logarithm math.log(8, 2)
e Exponent math.exp(1)
g GCD math.gcd(20, 12)
i Mod Inverse pow(3, -1, 11)
p Permutation math.perm(5, 2)
k Combination math.comb(5, 2)
s Sine math.sin(math.pi/2)
c Cosine math.cos(0)
t Tangent math.tan(math.pi/4)
! Factorial math.factorial(5)
x XOR 5 ^ 3
< Rotate Left (x << y) │ (x >> (bits - y))
> Rotate Right (x >> y) │ (x << (bits - y))
o Round round(3.1415, 2)
& Random (RNG) random.randint(1, 10)
b Binary bin(10)
8 Octal oct(10)
h Hexadecimal hex(255)
f From Base int('1010', 2)
5 MD5 Hash hashlib.md5(b"hello").hexdigest()
6 SHA256 Hash hashlib.sha256(b"hello").hexdigest()
a Average sum([1, 2, 3, 4]) / len([1, 2, 3, 4])
# Median statistics.median([1, 3, 2, 4])
$ Lambda (safe eval) eval("sin(pi / 2)", {"__builtins__":{}}, ...)
3 Quadratic Formula quadratic(1, -3, 2) → roots of x²-3x+2
d Date Now int(time.time())
q Quit Exit program
? Help Show help menu

About

Console calculator in Python

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages