Need help with statistics interview question
#1
I'm having trouble with one of the statistics interview questions from this resource. The question is:

Given a data set X, calculate the mean and variance of X.

I've tried to solve the problem using the following code:

Code:
mean = 0
for i in range(len(X)):
    mean += X[i]
mean = mean/len(X)
variance = 0
for i in range(len(X)):
    variance += (X[i]-mean)**2
variance = variance/len(X)

But when I run the code, I get an error. Can anyone help me figure out what the problem is? Any help would be greatly appreciated. Thanks!
Reply
#2
I don't see X defined anywhere
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Need help understanding Informatica Interview Questions Avantika_Sharmaa24 0 328 May 12, 2023, 06:07 am
Last Post: Avantika_Sharmaa24
  need help silenten1gma 4 15,932 Mar 28, 2023, 09:21 am
Last Post: commentos
  DAMN IT I NEED HELP ! Ladyanne3 4 4,155 Mar 28, 2023, 09:19 am
Last Post: commentos
  Trouble with Deep Learning Interview Questions Avantika_Sharmaa24 2 1,152 Mar 28, 2023, 08:30 am
Last Post: commentos
  Question about javascript f0xxii 2 21,619 Sep 02, 2021, 14:16 pm
Last Post: bertanen



Users browsing this thread: 1 Guest(s)