Skip to content

Commit f7b6bd9

Browse files
authored
Merge pull request #21 from HighnessAtharva/patch-4
Added working soltuion to FloorCeilRint
2 parents a64283b + 8a5ea92 commit f7b6bd9

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

Numpy/FloorCeilandRint.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,16 @@
44
Domain : Python
55
Author : Ahmedur Rahman Shovon
66
Created : 15 July 2016
7+
Updated : 17 March 2021
78
Problem : https://www.hackerrank.com/challenges/floor-ceil-and-rint/problem
89
'''
9-
import numpy
10-
np_ar = numpy.array(list(map(float,input().split())),float)
11-
print(numpy.floor(np_ar))
12-
print(numpy.ceil(np_ar))
13-
print(numpy.rint(np_ar))
10+
import numpy as np
11+
12+
np.set_printoptions(legacy='1.13')
13+
A = np.array(input().split(), float)
14+
print(np.floor(A))
15+
print(np.ceil(A))
16+
print(np.rint(A))
17+
18+
# Alternate solution
19+
# print(*(f(A) for f in [np.floor, np.ceil, np.rint]), sep='\n')

0 commit comments

Comments
 (0)