Download our latest MNC Answers Application at Play Store. Download Now

Basics of Statistics and Probability Hands-on Solution | TCS Fresco Play


Basics of Statistics and Probability Hands-on Solution  |  TCS Fresco Play

Basics of Statistics and Probability Fresco Play Hands-on Solutions

Disclaimer: The primary purpose of providing this solution is to assist and support anyone who are unable to complete these courses due to a technical issue or a lack of expertise. This website's information or data are solely for the purpose of knowledge and education.

Make an effort to understand these solutions and apply them to your Hands-On difficulties. (It is not advisable that copy and paste these solutions).

Course Path: Data Science/DATA SCIENCE BASICS/Basics of Statistics and Probability

Suggestion: Just Copy whole code from below and replace with existing code on hackerrank.

Basics of Statistics and Probability MCQ Solution

1.Welcome to Probability and Statistics -1

Permutations and Combinations - Hands-on


import numpy as np

from scipy import stats

import statistics


def measures(arr):

    #Write your code here

    '''

    Input: arr : numpy array    

    Return : mean,median,std_deviation,variance,mode,iqr  : float

    

    Note: 

    1. Assign the values to designated variables

    2. Round off to 2 decimal places

    '''

    mean=round(np.mean(arr),2)

    median=round(np.median(arr),2)

    std_deviation=round(np.std(arr),2)

    variance=round(np.var(arr),2)

    mode=round(statistics.mode(arr),2)

    iqr=round(stats.iqr(arr),2)

    

    return mean,median,std_deviation,variance,mode,iqr   


if __name__=='__main__':

Basics of Statistics and Probability MCQ Solution

2.Welcome to Probability and Statistics -2

Combinations with Factorial - Hands-on


from itertools import combinations

from itertools import permutations 

import numpy as np

import math


def comb_perm(arr):

    #Write your code here

    '''

    Input: arr : numpy array    

    Return : no_of_comb,no_of_perm : Integer

    

    '''

    no_of_comb= len(list(combinations(arr,2)))

    no_of_perm= len(list(permutations(arr,2)))

    return no_of_comb,no_of_perm


if __name__=='__main__':

Basics of Statistics and Probability MCQ Solution

3.Welcome to Probability and Statistics -3

Statistics

import math


def dancers():

    '''

    output: ans : Integer

    '''

    #Write your code here

    #Assign your value to variable ans

    

    ans= 200

    return int(ans)


if __name__=='__main__':

Basics of Statistics and Probability MCQ Solution

4.Welcome to Probability and Statistics -4

Mutually Exclusive Events


from scipy import stats

def binomial():

    '''

    output: ans : Float

    '''

    #Write your code here

    #Assign the probability value to the variable ans

    #Round off to 2 decimal places


    ans = 0.97

    return ans


if __name__=='__main__':

Basics of Statistics and Probability MCQ Solution

5.Welcome to Probability and Statistics -5

Non-mutually Exclusive Events


from scipy import stats


def poisson():

    '''

    output: ans : Float

    '''

    #Write your code here

    #Assign the probability value to the variable ans

    #Round off to 2 decimal places


    ans= 0.03

    return ans


if __name__=='__main__':

Basics of Statistics and Probability MCQ Solution

6.Welcome to Probability and Statistics -6

Binomial - Hands-on


from scipy import stats


def spinner():

    '''

    output: ans : Float

    '''

    #Write your code here

    #Assign the probability value to the variable ans

    # Round off to 2 decimal places


    ans= 0.5

    return ans 


if __name__=='__main__':


7.Welcome to Probability and Statistics -7

Poisson - Hands-on


from scipy import stats


def accident():

    '''

    output: ans : Float

    '''

    #Write your code here

    #Assign the probability value to the variable ans. Round off to 2 decimal places


    ans= 0.26

    return ans


if __name__=='__main__':

Basics of Statistics and Probability MCQ Solution

8.Welcome to Probability and Statistics -8

Chi-squared Test - Hands-on


from scipy.stats import chi2_contingency

from scipy.stats import chi2


def chi_test():

    '''

    Output

    1. stat: Float

    2. dof : Integer

    3. p_val: Float

    4. res: String

    '''

    #Note: Round off the Float values to 2 decimal places.

    

    stat= 23.57

    dof= 12

    p_val= 0.02

    res= "Reject the Null Hypothesis"

    

    return stat,dof,p_val,res   


if __name__=='__main__':


Basics of Statistics and Probability MCQ Solution