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

Popular posts from this blog

Quotation marks to wrap an element in HTML

What is the difference between iostream and iostream.h in cpp?

The Basic Structure of a Full-Stack Web App