## Piling Up in python – HackerRank Solution

There is a horizontal row of n cubes. The length of each cube is given. You need to create a new vertical pile of cubes. The new pile should follow … Read More

## Linear Algebra in Python – HackerRank Solution

The NumPy module also comes with a number of built-in routines for linear algebra calculations. These can be found in the sub-module linalg. linalg.det The linalg.det tool computes the determinant of an … Read More

## Polynomials in Python – HackerRank Solution

PolyThe poly tool returns the coefficients of a polynomial with the given sequence of roots. print numpy.poly([-1, 1, 1, 10]) #Output : [ 1 -11 9 11 -10] rootsThe roots … Read More

## Inner and Outer in Python – HackerRank Solution

innerThe inner tool returns the inner product of two arrays.  import numpy A = numpy.array([0, 1]) B = numpy.array([3, 4]) print numpy.inner(A, B) #Output : 4 outer The outer tool returns the outer product of … Read More

## Dot and Cross in Python – HackerRank Solution

dotThe dot tool returns the dot product of two arrays. import numpy A = numpy.array([ 1, 2 ]) B = numpy.array([ 3, 4 ]) print numpy.dot(A, B) #Output : 11 … Read More

## Mean, Var, and Std in Python – HackerRank Solution

meanThe mean tool computes the arithmetic mean along the specified axis. import numpy my_array = numpy.array([ [1, 2], [3, 4] ]) print numpy.mean(my_array, axis = 0) #Output : [ 2. … Read More

## Min and Max in Python – HackerRank Solution

MinThe tool min returns the minimum value along a given axis. import numpy my_array = numpy.array([[2, 5], [3, 7], [1, 3], [4, 0]]) print numpy.min(my_array, axis = 0) #Output : … Read More

## Sum and Prod in Python – HackerRank Solution

Sum The sum tool returns the sum of array elements over a given axis.  import numpy my_array = numpy.array([ [1, 2], [3, 4] ]) print numpy.sum(my_array, axis = 0) #Output : … Read More

## Floor, Ceil and Rint in Python HackerRank Solution

floorThe tool floor returns the floor of the input element-wise.The floor of x is the largest integer i where i <= x. import numpy my_array = numpy.array([1.1, 2.2, 3.3, 4.4, … Read More

## Array Mathematics in Python – HackerRank Solution

Basic mathematical functions operate element-wise on arrays. They are available both as operator overloads and as functions in the NumPy module. import numpy a = numpy.array([1,2,3,4], float) b = numpy.array([5,6,7,8], … Read More

## Eye and Identity in Python – HackerRank Solution

identity :The identity tool returns an identity array. An identity array is a square matrix with all the main diagonal elements as 1 and the rest as 0. The default … Read More

## Zeros and Ones in Python – HackerRank Solution

zerosThe zeros tool returns a new array with a given shape and type filled with 0’s. import numpy print numpy.zeros((1,2)) #Default type is float #Output : [[ 0. 0.]] print … Read More