HackerRank Arrays problem solution in Python YASH PAL, 31 July 202417 January 2026 HackerRank Arrays problem solution in Python – In this Arrays problem, You are given a space-separated list of numbers. Your task is to print a reversed NumPy array with the element type float.The NumPy (Numeric Python) package helps us manipulate large arrays and matrices of numeric data. To use the NumPy module, we need to import it using:import numpy ArraysA NumPy array is a grid of values. They are similar to lists, except that every element of an array must be the same type. import numpy a = numpy.array([1,2,3,4,5]) print a[1] #2 b = numpy.array([1,2,3,4,5],float) print b[1] #2.0 In the above example, numpy.array() is used to convert a list into a NumPy array. The second argument (float) can be used to set the type of array elements.Problem solution in Python 2 programming.# See https://www.hackerrank.com/challenges/np-arrays # "You are given a space separated list of numbers. # Your task is to print a reversed NumPy array with the element type float." import numpy print numpy.array(map(float, raw_input().split()), float)[::-1]Problem solution in Python 3 programming.def arrays(arr): #revrser array first, convert to float array with numpy return(numpy.array(arr[::-1], float))Problem solution in pypy programming.import numpy def main(): N = numpy.array(list(raw_input().strip().split()), float) r_N = N[::-1] print(r_N) main()# Enter your code here. Read input from STDIN. Print output to STDOUTProblem solution in pypy3 programming.# Enter your code here. Read input from STDIN. Print output to STDOUT import numpy as np a=input().split() z=np.array(a,float) #z = np.array(input().split(), float) print (z[::-1]) coding problems solutions Hackerrank Problems Solutions Python Solutions HackerRankPython