This commit is contained in:
thad-w541
2025-11-02 12:19:04 -06:00
commit 9306ac956d
3 changed files with 42 additions and 0 deletions

12
README.md Normal file
View File

@@ -0,0 +1,12 @@
# Python Desk Calculator
An easy way to make python a desk calculator
More features maybe coming soon
Right now all this does is import the `math` library (`as *`) so that you get `sin`, `cos`, etc. out of the box. Also makes sind, cosd, etc.
# Install
`git clone <this repo>`
`sudo ln -s /path/to/pdc/pdc /usr/bin/pdc`
`sudo chmod +x /usr/bin/pdc`

3
pdc Executable file
View File

@@ -0,0 +1,3 @@
#!/bin/bash
python3 -i /home/thad/pdc/pdc.py

27
pdc.py Normal file
View File

@@ -0,0 +1,27 @@
## Math ##
from math import *
def sind(x):
return sin(radians(x))
def cosd(x):
return cos(radians(x))
def tand(x):
return tan(radians(x))
def asind(x):
return degrees(asin(x))
def acosd(x):
return degrees(acos(x))
def atand(x):
return degrees(atan(x))
def atan2d(a, b):
return degrees(atan2(a, b))
def norm(*args):
return sqrt(sum([float(a)**2 for a in args]))