Python Practice › NumPy Programs › Program 98

Ceiling of each element

EasyNumPy Programs · 98 of 100

Write a NumPy program to round elements up with ceil.

Advertisement
Input
[4.8757, 2.4578]
Output
[5. 3.]

Approach

  1. np.ceil.

Solution

Python
import numpy as npprint(np.ceil([4.8757, 2.4578]))
Output
[5. 3.]
Advertisement

Learn the concept

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

More numpy programs

← All 100 NumPy Programs