HackerRank Solutions : Hi Programmers/Coders, Today we will share arrangements of Mean, Var, and Std in Python – HackerRank Solutions At Each Problem with Successful accommodation with all Test Cases Passed, you will get a score or stamps. What’s more, subsequent to taking care of greatest issues, you will get stars. This will feature your profile to the scouts.
in this article , you will track down the answer forMean, Var, and Std in Python – HackerRank Solutions. We are giving the right and tried arrangements of coding issues present on HackerRank. In the event that you can’t tackle any issue, then, at that point, you can take help from our Blog.
Read More: Say Hello, World! With Python | HackerRank Programming Solutions | HackerRank Python Solutions
Introduction To Python
HackerRank Solutions: Python is a broadly utilized, deciphered, object-situated, and significant level programming language with dynamic semantics, utilized for universally useful programming. It was made by Guido van Rossum, and first delivered on February 20, 1991.
Python is a PC programming language frequently used to construct sites and programming, computerize errands, and direct information examination. It is additionally used to make different AI calculation, and helps in Artificial Intelligence. Python is a broadly useful language, meaning it very well may be utilized to make a wide range of projects and isn’t particular for a particular issues. This flexibility, alongside its novice cordiality, has made it one of the most-utilized programming dialects today. An overview led by industry expert firm RedMonk observed that it was the most famous programming language among designers in 2020.
Read More: IBM Data Science Professional Certificate Course Answers 2022
Read More: Say Hello, World! With Python | HackerRank Python Solutions
Mean, Var, and Std in Python – HackerRank Solutions
Problem:
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. 3.]
print numpy.mean(my_array, axis = 1) #Output : [ 1.5 3.5]
print numpy.mean(my_array, axis = None) #Output : 2.5
print numpy.mean(my_array) #Output : 2.5
By default, the axis is None. Therefore, it computes the mean of the flattened array.
varThe var tool computes the arithmetic variance along the specified axis.
import numpy
my_array = numpy.array([ [1, 2], [3, 4] ])
print numpy.var(my_array, axis = 0) #Output : [ 1. 1.]
print numpy.var(my_array, axis = 1) #Output : [ 0.25 0.25]
print numpy.var(my_array, axis = None) #Output : 1.25
print numpy.var(my_array) #Output : 1.25
HackerRank Solutions
By default, the axis is None. Therefore, it computes the variance of the flattened array. stdThe std tool computes the arithmetic standard deviation along the specified axis.
import numpy
my_array = numpy.array([ [1, 2], [3, 4] ])
print numpy.std(my_array, axis = 0) #Output : [ 1. 1.]
print numpy.std(my_array, axis = 1) #Output : [ 0.5 0.5]
print numpy.std(my_array, axis = None) #Output : 1.11803398875
print numpy.std(my_array) #Output : 1.11803398875
By default, the axis is None. Therefore, it computes the standard deviation of the flattened array.
Output Format :
First, print the mean.
Second, print the var.
Third, print the std.
Sample Input :
2 2 1 2 3 4
Sample Output :
[ 1.5 3.5] [ 1. 1.] 1.11803398875
HackerRank Solutions
Task :
You are given a 2-D array of size NXM.
Your task is to find:The mean along axis 1The var along axis 0The std along axis
Input Format :
The first line contains the space separated values of N and M.
The next N lines contains M space separated integers.
Read More: 400-101 Facebook Certified Media Planning Professional Answers 2022
Read More: Dot and Cross in Python | HackerRank Solutions
Read More: Python: Division | HackerRank Solutions
Read More: Arithmetic Operators in Python | Hackerrank Python Solutions
Read More: Python If-Else Program | HackerRank Solutions and Answers
Read More: Say Hello, World! With Python | HackerRank Programming Solutions | HackerRank Python Solutions
Read More: IBM Data Science Professional Certificate Course Answers 2022