9. Write a Python Numpy program to convert the angles from degrees to radians
The output is:
a = [-360., -270., -180., -90., 90., 180., 270., 360.]
Expected Answer:
Initial angles in degrees:
[-360. -270. -180. -90. 90. 180. 270. 360.]
Convert to radians:
[-6.28318531 -4.71238898 -3.14159265 -1.57079633 1.57079633 3.14159265 4.71238898 6.28318531]
Sample Answer:
import numpy as np a = np.array([-360., -270., -180., -90., 90., 180., 270., 360.]) r1 = np.radians(a) print('Initial angles in degrees: ') print(a) print('\nConvert to radians:') print(r1)
More Exercises:
Python String ExercisesMore Numpy Exercises:
Numpy String ExercisesMore Pandas Exercises:
Pandas Series ExercisesMore Tutorials:
Python Installation - Linux (Ubuntu)