Skip to content
Programming101
Programmingoneonone
  • Home
  • CS Subjects
    • Internet of Things (IoT)
    • Digital Communication
    • Human Values
  • Programming Tutorials
    • C Programming
    • Data structures and Algorithms
    • 100+ Java Programs
    • 100+ C Programs
  • HackerRank Solutions
    • HackerRank Algorithms Solutions
    • HackerRank C problems solutions
    • HackerRank C++ problems solutions
    • HackerRank Java problems solutions
    • HackerRank Python problems solutions
Programming101
Programmingoneonone

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 solutions Python Solutions

Post navigation

Previous post
Next post

Pages

  • About US
  • Contact US
  • Privacy Policy

Programing Practice

  • C Programs
  • java Programs

HackerRank Solutions

  • C
  • C++
  • Java
  • Python
  • Algorithm

Other

  • Leetcode Solutions
  • Interview Preparation

Programming Tutorials

  • DSA
  • C

CS Subjects

  • Digital Communication
  • Human Values
  • Internet Of Things
  • YouTube
  • LinkedIn
  • Facebook
  • Pinterest
  • Instagram
©2025 Programmingoneonone | WordPress Theme by SuperbThemes