Python Practice › NumPy Programs › Program 91
Sine of angles
Write a NumPy program to calculate the sine of angles.
Input
0, 30, 90 degrees
Output
[0. 0.5 1. ]
Approach
- Convert degrees to radians, then
np.sin.
Solution
import numpy as npprint(np.sin(np.radians([0, 30, 90])).round(3))Output
[0. 0.5 1. ]
Learn the concept
New to this topic? Read the lesson, then come back.