subject

Statisticians would like to have a set of functions to compute the median and mode of a list of numbers. The median is the number that would appear at the midpoint of a list if it were sorted. The mode is the number that appears most frequently in the list. Also include a function named mean, which computes the average of a set of numbers. The main() has been provided for you. Define the three functions median, mode, mean in a module named stats. py. Each function expects a list of numbers as an argument and returns a single number. Your program's output should look like the following: Mode: 2 Median: 2 Mean: 2 Given Code:
def main():
lyst = []
for i in range(6):
lyst. append(int(input('Enter a Value for the list: ')))
print("List:", lyst)
print("Mode:", mode(lyst))
print("Median:", median(lyst))
print("Mean:", mean(lyst))
if __name__ == "__main__":
main()

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 16:20
It policy compliance and emerging technologies respond to the following: propose at least three control measures that organizations need to put in place to ensure that they remain complaint with emerging technologies and in a continually changing it environment. examine the correlation of effective configuration management and change control procedures to remain compliant with emerging technologies and it security changes.
Answers: 2
question
Computers and Technology, 24.06.2019 19:20
Kiesha has a worksheet with a range of cells using the following columns: name, score, group, study group, and date. kiesha needs to sort the worksheet on the date field. which option she use to most efficiently complete this task ? a use the cut and paste option to reorganize the data to fit that order b use the filter function to organize the data based on the date c use the order function to organize the data based on the date d use the sort function to organize the data based on date order
Answers: 3
question
Computers and Technology, 24.06.2019 21:30
Computer security/cybersecurity1) each of the following code fragments contains a number of security vulnerabilities. for each fragment, identify these security vulnerabilities and, for each vulnerability, discuss at least one way that it could be improved. note that in your discussion of how each vulnerability could be improved, you do not need to re-write a new version of the program in c; simply discuss your solution, either in pseudocode or in 1-2 sentences.a) /* file descriptor leak */#include #include int main(int argc, char *argv[]){ char *filepath = argv[0]; char *shellpath = argv[1]; file *passwords; passwords = fopen(filepath, "r"); /* read the password and do something with it */ /* . . */ /* fork and execute alternative shell */ execl(shellpath, "shell", null); }b)#include /* assume the following function is written for an electronic storefront. the user will enter the id of the item to be ordered, as well as the quantity of units that they would like to purchase. the program will then lookup the price for the price for the item using a predefined function, and return the total cost of the order.*/int gettotalcost(){ char itemid[9]; int price, unitsordered, cost; printf(" enter the 9-digit id of the item to be ordered: "); scanf("%s", & itemid); /* lookup the price according to the itemid */ price = getpricebyid(itemid); printf(" enter the quantity of units to be ordered: "); scanf("%d", & unitsordered); cost = price * unitsordered; return cost; }c)#include /* the following function is intended to return a user's full name by concatenating the user's first and last name into a single string and then returning that string. */char *getfullname(char *firstname, char *lastname, int max_len){ char fullname[max_len]; strcpy(fullname, firstname); strcat(fullname, " "); strcat(fullname, lastname); return fullname; }d)#include /* the following code snippet runs through the list of cli arguments entered and displays them to the console. */int main(int argc, char *argv[]){ int i; printf("you've entered the following arguments: "); for(i = 0; i < argc; i++){ print(argv[i]); printf("\n"); } /* */}
Answers: 2
question
Computers and Technology, 25.06.2019 00:00
One difference of input method between most desktop computers and most tablets is the memory the touch screen the speech recognition
Answers: 1
You know the right answer?
Statisticians would like to have a set of functions to compute the median and mode of a list of numb...
Questions
question
Mathematics, 27.11.2021 19:50
question
Mathematics, 27.11.2021 19:50
question
Mathematics, 27.11.2021 19:50
question
History, 27.11.2021 19:50
question
Biology, 27.11.2021 19:50
question
Mathematics, 27.11.2021 19:50
Questions on the website: 13722360