Python Practice › NumPy Programs › Program 91

Sine of angles

EasyNumPy Programs · 91 of 100

Write a NumPy program to calculate the sine of angles.

Advertisement
Input
0, 30, 90 degrees
Output
[0.  0.5 1. ]

Approach

  1. Convert degrees to radians, then np.sin.

Solution

Python
import numpy as npprint(np.sin(np.radians([0, 30, 90])).round(3))
Output
[0.  0.5 1. ]
Advertisement

Learn the concept

New to this topic? Read the lesson, then come back.

More numpy programs

← All 100 NumPy Programs