Skip to content
Programming101
Programming101

Learn everything about programming

  • Home
  • CS Subjects
    • IoT – Internet of Things
    • Digital Communication
    • Human Values
  • Programming Tutorials
    • C Programming
    • Data structures and Algorithms
  • HackerRank Solutions
    • HackerRank Algorithms Solutions
    • HackerRank C problems solutions
    • HackerRank C++ problems solutions
    • HackerRank Java problems solutions
    • HackerRank Python problems solutions
Programming101
Programming101

Learn everything about programming

HackerRank Arrays problem solution in python

YASH PAL, 31 July 2024

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.

HackerRank Arrays solution in python

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 STDOUT

Problem 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 python

Post navigation

Previous post
Next post
  • How AI Is Revolutionizing Personalized Learning in Schools
  • GTA 5 is the Game of the Year for 2024 and 2025
  • Hackerrank Day 5 loops 30 days of code solution
  • Hackerrank Day 6 Lets Review 30 days of code solution
  • Hackerrank Day 14 scope 30 days of code solution
©2025 Programming101 | WordPress Theme by SuperbThemes