각도 변환기
도, 라디안, 그라디안, 밀리라디안, 분각, 초각을 변환합니다.
자주 묻는 질문
코드 구현
import math
def degrees_to_radians(deg):
return deg * math.pi / 180
def radians_to_degrees(rad):
return rad * 180 / math.pi
def degrees_to_gradians(deg):
return deg * 400 / 360 # or deg * 10/9
def gradians_to_degrees(grad):
return grad * 360 / 400
# Examples
print(degrees_to_radians(90)) # 1.5707963... (π/2)
print(degrees_to_radians(180)) # 3.1415926... (π)
print(radians_to_degrees(math.pi)) # 180.0
print(degrees_to_gradians(90)) # 100.0
# Python also provides math.radians() and math.degrees()
print(math.radians(45)) # 0.7853981...
print(math.degrees(math.pi / 4)) # 45.0Comments & Feedback
Comments are powered by Giscus. Sign in with GitHub to leave a comment.