stud/I/Karto/lesson6/deg.py

13 lines
311 B
Python
Raw Permalink Normal View History

2019-11-28 17:51:15 +02:00
from math import pi
def deg(inp):
"""return angle in radians"""
if isinstance(inp, str) and '-' in inp:
deg, mm, ss = inp.split('-')
ddeg, dmm, dss = float(deg), float(mm), float(ss)
deg = ddeg + dmm/60 + dss/3600
else:
deg = float(instr)
return deg * pi / 180