Radians to Degrees and Degrees to Radians conversion in Python
Radians and Degrees are measures of angles.
Method # 1
import math
def rad2deg(radians):
degrees = math.degrees(radians)
print(f"The {radians} radian(s) is(are) equal to {degrees} degrees.")
def deg2rad(degrees):
radians = math.radians(degrees)
print(f"The {degrees} degrees are equal to {radians} radians.")
rad2deg(1)
deg2rad(57.296)
Method # 2
import math
def rad2deg(radians):
degrees = radians * (180 / math.pi)
print(f"The {radians} radian(s) is(are) equal to {degrees} degrees.")
def deg2rad(degrees):
radians = degrees * (math.pi / 180)
print(f"The {degrees} degrees are equal to {radians} radians.")
rad2deg(1)
deg2rad(57.296)
Mathematical Notation:
Comments
Post a Comment
Write something to CodeWithAbdur!