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