Question: Your program will report the same statistics as the last assignment for the list of data values (average, range, and standard deviation) and then report

Your program will report the same statistics as the last assignment for the list of data values (average, range, and standard deviation) and then report what percentage of the data values are between the minimum and the maximumcutoff values.If a data value is the same as one of the cutoff values, it should be considered "between" the cutoffs.

This is what I have so far:

count = int(input("How many data values do you have? "))

current_total = 0.00

numbers = []

while True:

number = float(input("Enter a floating-point value(any negative value to end):"))

if number < 0:

break

else:

numbers.append(number)

# add number to current total

current_total + number

print() # this print statement only for getting a new line

# iterating all the numbers through loop

for number in numbers:

#print the number

print(number)

print()# this print statement only for getting a new line

min_cutoff = float(input("Enter minimum cutoff value: "))

max_cutoff = float(input("Enter maximum cutoff value: "))

keep_numbers = []

for number in numbers:

if number >= min_cutoff and number <= max_cutoff:

keep_numbers.append(number)

#calculate average

data_average = current_total/count

print("The average of the dataset is", data_average)

#set first value as largest and smallest

largest = numbers[0]

smallest = numbers[0]

# set 0 as standard deviation

standard_dev = 0

# loop through each number in dataset

for number in numbers:

# add the square of difference from average to standard_dev

standard_dev +=(number - data_average) ** 2

#update largest if required

if number > largest:

largest = number

#update smallest if required

if number < smallest:

smallest = number

# finally divide the calculated standard_dev by count, and calculate the square root of it

standard_dev = (standard_dev / count) ** 0.5

#calculate and print data range

print("The range of the dataset is:", largest - smallest)

# print standard deviation

print("The standard deviation of the dataset is:", standard_dev)

How would I, in Python 3.9.6, get my algorithm to report what percentage of the data values are between the minimum and the maximumcutoff values and say if a data value is the same as one of the cutoff values, it should be considered "between" the cutoffs? Thank you!

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 Programming Questions!