Python Practice › NumPy Programs › Program 97
Floor of each element
Write a NumPy program to round elements down with floor.
Input
[4.8757, 2.4578]
Output
[4. 2.]
Approach
np.floor.
Solution
import numpy as npprint(np.floor([4.8757, 2.4578]))Output
[4. 2.]
Learn the concept
New to this topic? Read the lesson, then come back.