Sort by

recency

|

15 Discussions

|

  • + 0 comments

    Why is this a hard question? You can get the answers straight out of Excel.

    Incidentally, each student's score should be an integer and not a real number (as assumed in this question).

  • + 0 comments

    Answer:

    # Enter your code here. Read input from STDIN. Print output to STDOUT
    import math
    def get_function(x):
        mu = 70
        sig = 10
        gaussian_func = (1 / (sig * math.sqrt(2 * math.pi))) * math.exp(-((x - mu) ** 2) / (2 * sig ** 2))
        return gaussian_func
    
    start_value = 20
    end_value = 120
    step = 0.0001
    
    x = [start_value + i * step for i in range(int((end_value - start_value) / step) + 1)]
    y0 = 0
    y1 = 0
    y2 = 0
    y3 = 0
    
    for i in range(len(x)):
        y0 += get_function(x[i]) * step
        if x[i] > 80:
            y1 += get_function(x[i]) * step
    
        if x[i] >= 60:
            y2 += get_function(x[i]) * step
    
        if x[i] < 60:
            y3 += get_function(x[i]) * step
    
    y1 = y1 * 100 / y0
    y2 = y2 * 100 / y0
    y3 = y3 * 100 / y0
    
    result1 = round(y1, 2)
    result2 = round(y2, 2)
    result3 = round(y3, 2)
    
    print(str(result1))
    print(str(result2))
    print(str(result3))
    
  • + 0 comments

    from math import exp, factorial, pi, erf

    Cumulative Probability

    Probility that in a normal distribution the value is less than x.

    def CDF(x, mu, std): return 0.5*(1+erf((x-mu)/(std*((2**0.5)))))

  • + 0 comments

    Python code I used successfully:

    from scipy.stats import norm
    a=100*(1-norm.cdf(80, loc=70, scale=10))
    b=100*norm.sf(60, loc=70, scale=10)
    c=100*norm.cdf(60, loc=70, scale=10)
    
    print "%.2f" %a
    print "%.2f" %b
    print "%.2f" %c
    
  • + 0 comments

    is thr ny negative value for (b)part??