We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
# Enter your code here. Read input from STDIN. Print output to STDOUTimportmathdefget_function(x):mu=70sig=10gaussian_func=(1/(sig*math.sqrt(2*math.pi)))*math.exp(-((x-mu)**2)/(2*sig**2))returngaussian_funcstart_value=20end_value=120step=0.0001x=[start_value+i*stepforiinrange(int((end_value-start_value)/step)+1)]y0=0y1=0y2=0y3=0foriinrange(len(x)):y0+=get_function(x[i])*stepifx[i]>80:y1+=get_function(x[i])*stepifx[i]>=60:y2+=get_function(x[i])*stepifx[i]<60:y3+=get_function(x[i])*stepy1=y1*100/y0y2=y2*100/y0y3=y3*100/y0result1=round(y1,2)result2=round(y2,2)result3=round(y3,2)print(str(result1))print(str(result2))print(str(result3))
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Normal Distribution #3
You are viewing a single comment's thread. Return to all comments →
Answer: