ha math teacher i made a python script

This commit is contained in:
lickthecheese 2020-01-30 20:19:09 -05:00
parent 1700f8dc33
commit 7518a264b8

37
bin/circomference.py Executable file
View file

@ -0,0 +1,37 @@
#!/usr/bin/env python3
import math
si = input('size append d r c a> ')
st = si[-1:]
si = float(si[:-1])
def fromD(di):
r = di/2
fromR(r)
def fromC(ce):
r = ce / 6.28
fromR(r)
def fromA(ar):
r = math.sqrt(ar/3.14)
fromR(r)
def fromR(ra):
print("radius",ra)
print("diam", ra*2)
print("cerc", 3.14 * (ra*2))
print("area", 3.14*(ra*ra))
funcs = {
'd':fromD,
'r':fromR,
'c':fromC,
'a':fromA
}
funcs[st](si)