Hackerrank Floor, Ceil and Rint Solution

Hackerrank Floor, Ceil and Rint Solution

Solution in python3

Approach 1.

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

Approach 2.

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

Approach 3.

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.

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.

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

Approach 3.

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

Subscribe to The Poor Coder | Algorithm Solutions

Don’t miss out on the latest issues. Sign up now to get access to the library of members-only issues.
[email protected]
Subscribe