At Westonci.ca, we connect you with the answers you need, thanks to our active and informed community. Experience the convenience of finding accurate answers to your questions from knowledgeable experts on our platform. Discover detailed answers to your questions from a wide network of experts on our comprehensive Q&A platform.
Sagot :
The program described above which calculates mean, median and standard deviations of all entered values is given below.
What is a program?
A program is a set of instructions that ensure that a predetermined or specific output is given by a computer.
The program labelled find_stas.py is given as follows:
# importing required libraries
import math
# creating a empty list named li
li = []
# iterate till while is true
while True:
# getting user input making it int and store it in inp
inp = int(input("Enter integer (0 to stop): "))
# checks if inp is equals to 0
if inp == 0:
# stop the loop
break
# append inp in li
li.append(inp)
n = len(li)
# calculating sum li using sum function then dividing by n and store it in mean
mean = sum(li) / n
# dividing n by 2 and store it in indexes
index = n // 2
# if n modulus n equals 2
if n % 2:
# sort the li and store the index position in median
median = sorted(li)[index]
# otherwise
else:
# store the result in media
median = sum(sorted(li)[index - 1:index + 1]) / 2
# declaring d variable with value 0
d = 0
# calculating variance and store it in variance
variance = sum((x - mean) ** 2 for x in li) / (n - d)
# standard deviation
sd = math.sqrt(variance)
# display the output with the value of mean, median and sd
print("Mean : {}\nStandard Deviation : {}\nMedian : {}".format(mean, median, sd))
Learn more about programs:
https://brainly.com/question/26134656
#SPJ1
Visit us again for up-to-date and reliable answers. We're always ready to assist you with your informational needs. Thank you for choosing our platform. We're dedicated to providing the best answers for all your questions. Visit us again. Westonci.ca is your trusted source for answers. Visit us again to find more information on diverse topics.