Question

Need the code in python. At certain Olympic events, there are 5 judges. To determine an...

Need the code in python.

At certain Olympic events, there are 5 judges. To determine an athlete’s final score for the event, the highest and lowest judges’ scores are discarded and then the average of the rest of the scores is calculated. Assume that the array 'Scores' contains the judges’ scores. Write a function that accepts as an argument a list of scores and returns the athlete’s final score.

(Hint: Add up all the scores in the array. Find the highest and lowest scores and subtract them out. Divide sum by len(Scores) – 2 and return as the average.)

0 0
Add a comment Improve this question Transcribed image text
Answer #1

The required program is given below. In case of any query please ask me in comments.

main.py

def average(scores):
total = 0
for i in scores:
total += i
highest = max(scores)
lowest = min(scores)
total = total - highest - lowest
avg = total/(len(scores) - 2)
return avg

def main():
Scores = [85,65,45,90,72]
print("Average Score :",average(Scores))
  
main()

OUTPUT

Run Debug Stop Share Save {} Beautify Language Python 3 @ main.py 1-def average (scores): 2 total = 0 for i in scores: total

Add a comment
Know the answer?
Add Answer to:
Need the code in python. At certain Olympic events, there are 5 judges. To determine an...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • psuedocode and raptor flow chart- i need the basic psuedocode and raptor flow chart with reverse...

    psuedocode and raptor flow chart- i need the basic psuedocode and raptor flow chart with reverse loop logic. For this program, you will calculate a student's average for a semester. The student has earned 6 test grades during the semester, and their average is calculated after removing the lowest grade from the scores. Write a program that asks the user to enter the six grades and stores them in an array. Then, search the array for the lowest value and...

  • ***C++ Code*** What this Assignment Is About: -Learn to define and call void & non-void functions...

    ***C++ Code*** What this Assignment Is About: -Learn to define and call void & non-void functions -Learn to use reference variables Coding Guidelines for All Labs/Assignments (You will be graded on this) -Give identifiers semantic meaning and make them easy to read (examples numStudents, grossPay, etc). -Keep identifiers to a reasonably short length. -Use upper case for constants. Use title case (first letter is upper case) for classes. Use lower case with uppercase word separators for all other identifiers (variables,...

  • Please I need help in C language, I am trying to modify the code per the...

    Please I need help in C language, I am trying to modify the code per the below instructions, but I am getting errors. Can't fgure it out. The attempted code modification and data file is privided below, after the instructions. Thank you. Instructions:                  1.      First, add a function named printMsg that displays a message, a greeting, or an introduction to the program for the user. Add a statement that calls that function from the main function when your program starts....

  • Program 7 Arrays: building and sorting (100 points) Due: Friday, October 30 by 11:59 PM Overview...

    Program 7 Arrays: building and sorting (100 points) Due: Friday, October 30 by 11:59 PM Overview For this assignment, write a program that will calculate the quiz average for a student in the CSCI 240 course. The student's quiz information will be needed for later processing, so it will be stored in an array. For the assignment, declare one array that will hold a maximum of 12 integer elements (ie. the quiz scores). It is recommended that this program be...

  • Python Problem: Variance Explanation: Problem 1: Computing variance For this problem, you will write a function...

    Python Problem: Variance Explanation: Problem 1: Computing variance For this problem, you will write a function variance that takes a list whose elements are numbers (floats or ints), and returns their variance, a single number. (If you don't remember how to compute variance, check the lecture notebook; it's one of the intermediate steps in computing standard deviation.) You should not use NumPy or any other Python libraries for this problem. For now, worry only about correctness, not efficiency. Passing an...

  • Could anyone help add to my python code? I now need to calculate the mean and...

    Could anyone help add to my python code? I now need to calculate the mean and median. In this programming assignment you are to extend the program you wrote for Number Stats to determine the median and mode of the numbers read from the file. You are to create a program called numstat2.py that reads a series of integer numbers from a file and determines and displays the following: The name of the file. The sum of the numbers. The...

  • python 3 question Project Description Electronic gradebooks are used by instructors to store grades on individual assignments and to calculate students’ overall grades. Perhaps your instructor uses gr...

    python 3 question Project Description Electronic gradebooks are used by instructors to store grades on individual assignments and to calculate students’ overall grades. Perhaps your instructor uses gradebook software to keep track of your grades. Some instructors like to calculate grades based on what is sometimes called a “total points” system. This is the simplest way to calculate grades. A student’s grade is the sum of the points earned on all assignments divided by the sum of the points available...

  • Program 7 File Processing and Arrays (100 points) Overview: For this assignment, write a program that...

    Program 7 File Processing and Arrays (100 points) Overview: For this assignment, write a program that will process monthly sales data for a small company. The data will be used to calculate total sales for each month in a year. The monthly sales totals will be needed for later processing, so it will be stored in an array. Basic Logic for main() Note: all of the functions mentioned in this logic are described below. Declare an array of 12 float/doubles...

  • PYTHON 3 Object Oriented Programming ***a9q3.py file below*** class GradeItem(object): # A Grade Item is anything...

    PYTHON 3 Object Oriented Programming ***a9q3.py file below*** class GradeItem(object): # A Grade Item is anything a course uses in a grading scheme, # like a test or an assignment. It has a score, which is assessed by # an instructor, and a maximum value, set by the instructor, and a weight, # which defines how much the item counts towards a final grade. def __init__(self, weight, scored=None, out_of=None): """ Purpose: Initialize the GradeItem object. Preconditions: :param weight: the weight...

  • C++ Programming

    PROGRAM DESCRIPTIONIn this project, you have to write a C++ program to keep track of grades of students using structures and files.You are provided a data file named student.dat. Open the file to view it. Keep a backup of this file all the time since you will be editing this file in the program and may lose the content.The file has multiple rows—each row represents a student. The data items are in order: last name, first name including any middle...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT