Question: import random # Initialize array myArray = [] a = 0 b = 1 size = 25 j = 0 n =10 # Populate array

import random # Initialize array myArray = [] a = 0 b = 1 size = 25 j = 0 n =10 # Populate array with size = 25 random integers in the range 0 - 1 #and repeat for n times while (j < n): for kin range(size): randNum = random.randint(a,b) myArray.insert(k, randNum) j = j + 1 # Display array size print("size of my array is :", len(myArray)) # printmyArray 10 values per line k = 0 sub = [] while (k "...",k, sub) k = k+10 ones = 33 #place holder code only FIX zeros = -8 # place holder code FIX print(" number of 1 is: ", ones) print(" number of 0 is: ", zeros) # mean and standard deviation (sd) calculations here #EXAMPLE ONLY mean = 100 sd = 5 print("=====================") print('mean of My Array:', mean, " sd (standard deviation: ", sd) print (" mean +-sd: ",mean + sd, " " , mean - sd )

print("the mean number of 1's is within mean +- sd ??? YES/NO ")

# need to answer this

# compare the number of 1s (variable zeros calculated above

# to see if it is within the range mean sd.

OUTPUT of the sample code

size of my array is : 250

... 0 [0, 1, 0, 0, 0, 0, 0, 1, 1, 1]

... 10 [0, 1, 1, 1, 0, 1, 1, 1, 1, 0]

... 20 [0, 0, 0, 1, 1, 0, 0, 0, 1, 1]

... 30 [1, 1, 1, 1, 1, 1, 0, 0, 1, 0]

... 40 [1, 0, 1, 1, 1, 0, 0, 1, 0, 0]

... 50 [0, 0, 1, 1, 0, 1, 1, 1, 1, 0]

... 60 [1, 0, 0, 0, 1, 0, 0, 0, 0, 1]

... 70 [1, 1, 0, 1, 1, 0, 1, 1, 0, 0]

... 80 [0, 0, 0, 0, 1, 1, 1, 1, 0, 0]

... 90 [1, 1, 1, 0, 0, 1, 1, 0, 0, 1]

... 100 [0, 1, 1, 0, 0, 1, 1, 0, 1, 0]

... 110 [1, 1, 0, 0, 1, 0, 1, 0, 0, 0]

... 120 [1, 0, 0, 0, 0, 0, 0, 1, 1, 1]

... 130 [0, 1, 0, 0, 1, 1, 0, 1, 1, 1]

... 140 [1, 0, 0, 0, 1, 0, 0, 1, 0, 0]

... 150 [0, 0, 1, 1, 0, 1, 0, 1, 1, 1]

... 160 [0, 1, 1, 1, 0, 1, 0, 1, 1, 0]

... 170 [1, 1, 0, 1, 1, 1, 1, 0, 1, 0]

... 180 [0, 1, 1, 1, 0, 1, 0, 0, 0, 1]

... 190 [1, 1, 1, 1, 0, 0, 1, 1, 0, 1]

... 200 [0, 1, 1, 1, 1, 0, 0, 0, 1, 1]

... 210 [1, 0, 1, 1, 1, 1, 1, 0, 0, 0]

... 220 [1, 1, 0, 0, 1, 0, 1, 1, 0, 1]

... 230 [0, 0, 1, 1, 1, 1, 0, 0, 1, 0]

... 240 [1, 0, 0, 1, 1, 0, 1, 0, 1, 0]

number of 1 is: 33

number of 0 is: -8

=====================

mean of My Array: 100 sd (standard deviation: 5

mean +-sd: 105 95

the mean number of 1's is within mean +- sd ???

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!