Generation

generate functionFri, 17 Mar 2023

Определите размер необходимой выборки для исследования среднего чека за кофе в городе N, если известны следующие параметры: погрешность (delta); дисперсия (sigsqr); уровень доверия (conf). Ответ округлите до целого.

def checkio(delta, sigsqr, conf): # Your code here # It's main function. Don't remove this function # It's using for auto-testing and must return a result for check. import scipy.stats as st import numpy as np n = ((st.norm.ppf((1+conf)/2))**2*sigsqr)/(delta**2) return int(n) # Some hints # You can use stats.norm.ppf function for the normal distribution #These "asserts" using only for self-checking and not necessary for auto-testing if __name__ == '__main__': assert checkio(0.02, 0.04, 0.95) == 491 assert checkio(0.02, 0.005, 0.95) == 4127 print("Coding complete? Click 'Check' to earn cool rewards!")

Questions about programming?Chat with your personal AI assistant