Skip to content
the poor coder

Hackerrank Floor, Ceil and Rint Solution

Poor Man
Published
Updated
Reading time
1 min read

Solution in python3#

Approach 1.

Python
import numpy
a = numpy.array(input().split(),float)
print(numpy.floor(a),numpy.ceil(a),numpy.rint(a),sep="\n")

Approach 2.

Python
from numpy import *
A = array([float(x) for x in input().split()],float)
print(floor(A),ceil(A),rint(A),sep = '\n')

Approach 3.

Python
import numpy
a=numpy.array(input().split(" "), float)
print(numpy.floor(a))
print(numpy.ceil(a))
print(numpy.rint(a))

Solution in python#

Approach 1.

Python
import numpy as np
A =np.array(raw_input().split(),float)
print np.floor(A)
print np.ceil(A)
print np.rint(A)

Approach 2.

Python
import numpy
a=numpy.array(map(float,raw_input().split()))
print numpy.floor(a)
print numpy.ceil(a)
print numpy.rint(a)

Approach 3.

Python
import numpy
A = numpy.array(map(float, raw_input().split()))
print numpy.floor(A)
print numpy.ceil(A)
print numpy.rint(A)

Keep going

2020

Hackerrank Mean, Var, and Std Solution

mean The mean tool computes the arithmetic mean along the specified axis. By default, the axis is None. Therefore, it computes the mean of the flattened array. var The var tool computes the arithmetic variance along the…

2020

Hackerrank Polynomials Solution

poly The poly tool returns the coefficients of a polynomial with the given sequence of roots. roots The roots tool returns the roots of a polynomial with the given coefficients. polyint The polyint tool returns an…

2020

Hackerrank Linear Algebra Solution

The NumPy module also comes with a number of built-in routines for linear algebra calculations. These can be found in the sub-module linalg. linalg.det The linalg.det tool computes the determinant of an array…

ESC