Write a python program to compute some statitistics for a class of students’ scores on an assignment. Please using loops and working with lists, so write the functions WITHOUT using min(), max(), and sum(). The method should be append(),pop() etc.
The students’ scores should be stored in a list. The program should be able to compute the following:
-
the average (mean)
-
the median
-
the lowest score
-
the highest score
Write separate functions for each statistic and, write Pytest tests to practice unit testing functions with list parameters. A few suggestions of things to test:
-
a list with an even number of grades
-
a list with an odd number of grades
-
a sorted list
-
an unsorted list
-
an empty list
Trending nowThis is a popular solution!
Step by stepSolved in 4 steps with 2 images
- Python Qu Write a Python program (not a function!) that asks the user for nonnegative integers,one integer per line.When the user is finished entering their integers, they enter a negative integerto tell the program to stop asking them for more integers.Once the input is complete, the program prints "No integers to average"if the user provided no nonnegative integers,and the average of the nonnegative integers otherwise.You must NOT use lists, tuples, or dictionaries in your code.Here is a sample program run where the user enters 4 and then 8 and then -1.The program outputs Average: 6.048-1Average: 6.0Here is another run where the user types -3 to the first prompt.The program outputs No integers to average-3No integers to averagearrow_forwardIn c++ and without the use of vectors, please. Thanks very much! A contact list is a place where you can store a specific contact with other associated information such as a phone number, email address, birthday, etc. Write a program that first takes as input an integer N that represents the number of word pairs in the list to follow. Word pairs consist of a name and a phone number (both strings). That list is followed by a name, and your program should output the phone number associated with that name. Define and call the following function. The return value of FindContact is the index of the contact with the provided contact name. If the name is not found, the function should return -1 This function should use binary search. Modify the algorithm to output the count of how many comparisons using == with the contactName were performed during the search, before it returns the index (or -1). int FindContact(ContactInfo contacts[], int size, string contactName) Ex: If the input is: 3…arrow_forwardIn python, Problem Description:You are hosting a party and do not have room to invite all of your friends. You use the following unemotional mathematical method to determine which friends to invite. Number your friends 1, 2, . . . , K and place them in a list in this order. Then perform m rounds. In each round, use a number to determine which friends to remove from the ordered list. The rounds will use numbers r1, r2, . . . , rm. In round i remove all the remaining people in positions that are multiples of ri (that is, ri, 2ri, 3ri, . . .) The beginning of the list is position 1. Output the numbers of the friends that remain after this removal process. Input Specification:The first line of input contains the integer K (1 ≤ K ≤ 100). The second line of input contains the integer m (1 ≤ m ≤ 10), which is the number of rounds of removal. The next m lines each contain one integer. The ith of these lines (1 ≤ i ≤ m) contains ri ( 2 ≤ ri ≤ 100) indicating that every person at a position…arrow_forward
- Could you show me a different way to write this code in python? I’m trying to make the code simple and easy to understandarrow_forwardprogram- python Write a function called “missing”. Ask the user for a series of integers from 1 to N. Send that list to missing and have it return the list of what numbers are missing. For example, if they enter 1 3 7 10, then you would call missing on that list which returns the list of missing numbers and then you can let them know by printing out the list that they are missing 2 4 5 6 8 9. Test it out on this and show it works. PLEASE USE SET SUBTRACTIONarrow_forwardIn c++ and please without the use of vectors. Thanks very much! A contact list is a place where you can store a specific contact with other associated information such as a phone number, email address, birthday, etc. Write a program that first takes as input an integer N that represents the number of word pairs in the list to follow. Word pairs consist of a name and a phone number (both strings). That list is followed by a name, and your program should output the phone number associated with that name. Define and call the following function. The return value of FindContact is the index of the contact with the provided contact name. If the name is not found, the function should return -1 This function should use linear search. Modify the algorithm to output the count of how many comparisons were performed during the search, before it returns the index (or -1). int FindContact(ContactInfo contacts[], int size, string contactName) Ex: If the input is: 3 Joe 123-5432 Linda 983-4123…arrow_forward
- In Java: When analyzing data sets, such as data for human heights or for human weights, a common step is to adjust the data. This can be done by normalizing to values between 0 and 1, or throwing away outliers. For this program, adjust the values by subtracting the smallest value from all the values. The input begins with an integer indicating the number of integers that follow. Assume that the list will always contain fewer than 20 integers. Ex: If the input is: 5 30 50 10 70 65 the output is: 20 40 0 60 55 The 5 indicates that there are five values in the list, namely 30, 50, 10, 70, and 65. 10 is the smallest value in the list, so is subtracted from each value in the list. For coding simplicity, follow every output value by a space, including the last one. import java.util.Scanner; public class LabProgram {public static void main(String[] args) {/* Type your code here. */arrow_forwardin python Integer num_samples is read from input, representing the number of data samples to be read from input. List data_list contains the data samples read from the remaining input. For each element in data_list: If the element is greater than 25, output the element followed by ' at index ', the element's index in the list, and ' is flagged'. Otherwise, output the element followed by ' at index ', the element's index in the list, and ' is normal'.arrow_forwardThis task involves writing a program that calculates the standard deviation of all numbers in a list. First, the number of the number in the list is entered, then each number is entered. The program should print the standard deviation of the numbers in the list. Note, the values entered into the program are part of a random sample, which may need to be taken into account when choosing a method to calculate the standard deviation.arrow_forward
- Please answer quickly In pythonarrow_forwardUsing c++ Contact list: Binary Search A contact list is a place where you can store a specific contact with other associated information such as a phone number, email address, birthday, etc. Write a program that first takes as input an integer N that represents the number of word pairs in the list to follow. Word pairs consist of a name and a phone number (both strings). That list is followed by a name, and your program should output the phone number associated with that name. Define and call the following function. The return value of FindContact is the index of the contact with the provided contact name. If the name is not found, the function should return -1 This function should use binary search. Modify the algorithm to output the count of how many comparisons using == with the contactName were performed during the search, before it returns the index (or -1). int FindContact(ContactInfo contacts[], int size, string contactName) Ex: If the input is: 3 Frank 867-5309 Joe…arrow_forwardthis code should be in python: write a function that receives a list as its only parameter. Inside the function remove all the duplicate items from the list and returns a new list. For Example: If we call the function with [“dad”, “aunt”, “mom”, “sister”, “mom”] as its input, the returned value should be [“dad”, “aunt”, “mom”, “sister”]. The order of the items inside the returned list does not matter.arrow_forward
- Computer Networking: A Top-Down Approach (7th Edi...Computer EngineeringISBN:9780133594140Author:James Kurose, Keith RossPublisher:PEARSONComputer Organization and Design MIPS Edition, Fi...Computer EngineeringISBN:9780124077263Author:David A. Patterson, John L. HennessyPublisher:Elsevier ScienceNetwork+ Guide to Networks (MindTap Course List)Computer EngineeringISBN:9781337569330Author:Jill West, Tamara Dean, Jean AndrewsPublisher:Cengage Learning
- Concepts of Database ManagementComputer EngineeringISBN:9781337093422Author:Joy L. Starks, Philip J. Pratt, Mary Z. LastPublisher:Cengage LearningPrelude to ProgrammingComputer EngineeringISBN:9780133750423Author:VENIT, StewartPublisher:Pearson EducationSc Business Data Communications and Networking, T...Computer EngineeringISBN:9781119368830Author:FITZGERALDPublisher:WILEY