Question: Example: Given a list of 100K values, find the average and range of the list This is a task that is easier for computers because

 Example: Given a list of 100K values, find the average and

Example: Given a list of 100K values, find the average and range of the list This is a task that is easier for computers because we can write down a clear set of steps to complete this task (we can write an algorithm). Humans would not be good at completing this task, as there are a lot of steps to complete, and it would be slow, and we might not have the memory to do it. n [19]: # Pseudocode for array statistics def array_statistics(a,b): for x in range(a,b): length = len(x) print(length) average - (average + x)/ length return average y = array_statistics (1,100000) print(y) # Find the mean of the array. pass # To do so: # Find the total sum of the array # Find the number of elements in the array # Divide the sum by the number of elements # Find the range of the array. pass # To do so: # Find the maximum value of the array # Find the minimum value of the array # Calculate range by subtracting the max from the min for the array # Return the mean and range of the array return None TypeError Traceback (most recent call last) in average - (average + x) / length 7 return average 8 Y = array_statistics (1,100000) 9 print (Y 10 in array_statistics(a, b) 2 def array_statistics (a,b): 3 for x in range(a,b): length = len(x) 5 print(length average = (average + x) / length 4 6 TypeError: object of type 'int' has no len()

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!