Question

In: Computer Science

Instructions A particular talent competition has five judges, each of whom awards a score between 0...

Instructions

A particular talent competition has five judges, each of whom awards a score between 0 and 10 to each performer. Fractional scores, such as 8.3, are allowed. A performer’s final score is determined by dropping the highest and lowest score received, then averaging the three remaining scores. Write a program in Python that uses this method to calculate a contestant’s score. It should include the following functions:

  • getJudgeData( ) should ask the user for a judge’s score, and validate it. This function should be called by main once for each of the five judges and must return the score entered by the user.
  • calcScore( ) should calculate and display the average of the three scores that remain after dropping the highest and lowest scores the performer received. This function should be called just once by main and should be passed the five scores. This function does not return any values.

      The last two functions, described below, should be called by calcScore, which uses the returned information to determine which of the scores to drop.

  • findLowest( ) should find and return the lowest of the five scores passed to it.
  • findHighest( ) should find and return the highest of the five scores passed to it.

        Input Validation: Do not accept judge scores lower than 0 and higher than 10.

General Restrictions:

  1. No Global variables
  2. No labels or go-to statements
  3. No infinite loops in your programs; these are loops that do not have a definite logical expression of other condition to signal when the loops ought to terminate.
  4. No break statements to exit loops

Solutions

Expert Solution

#Python code
def getJudgeData():
    lst=[]
    for i in range(5):
        score=int(input("Enter the score between 0 and 10:"))
        while  score<0 or score>10:
            print("Value can only between 0 and 10,Enter again")
            score = int(input("Enter the score between 1 and 10:"))
        lst.append(score)
    return lst

def findLowest(scores):
    minVal=min(scores)
    return minVal
def findHighest(scores):
    maxVal=max(scores)
    return maxVal

def calcScore(scores):
    minVal=findLowest(scores)
    maxVal=findHighest(scores)
    scores.remove(minVal)
    scores.remove(maxVal)
    sum=0
    for x in scores:
        sum=sum+x
    average=sum/3
    print("{:.1f}".format(average))

def main():
    scores=getJudgeData()
    calcScore(scores)

if __name__=="__main__":
    main()

OUTPUT:


Related Solutions

In the sport of diving, seven judges award a score between 0 and 10, where each...
In the sport of diving, seven judges award a score between 0 and 10, where each score may be a floating-value. The highest and lowest scores are thrown out and the remaining scores are added together. The sum is then multiplied by the degree of difficulty for that drive. The degree of difficulty ranges from 1.2 to 3.8 points. The total is then multiplied by 0.6 to determine the diver’s score. Write a program that inputs a degree of difficulty...
Regarding their effects on competition for jobs and talent, what are the key differences between the...
Regarding their effects on competition for jobs and talent, what are the key differences between the opinions expressed in "It's a Flat World," by Thomas Friedman on the one hand, and the views of Richard Florida in "The World is Spiky" on the other? Include a discussion of your own views in this debate and how the the future that your position foretells will likely affect your own real or potential career options. How will emerging these "flat" and/or "spiky"...
in the war for talent, attracting the best staff is a competition between organisations. Discuss the...
in the war for talent, attracting the best staff is a competition between organisations. Discuss the ways that employer can attract the best people both internally and externally. In your answer. you should provide specific examples.
MLS Company has five employees, each of whom earns $1,600 per month and is paid on the last day of each month.
MLS Company has five employees, each of whom earns $1,600 per month and is paid on the last day of each month. All five have been employed continuously at this amount since January 1. On June 1, the following accounts and balances exist in its general ledger: a. FICA—Social Security Taxes Payable, $992; FICA—Medicare Taxes Payable, $232. (The balances of these accounts represent total liabilities for both the employer’s and employees’ FICA taxes for the May payroll only.) b. Employees’...
The score of a student on a certain exam is represented by a number between 0...
The score of a student on a certain exam is represented by a number between 0 and 1. Suppose that the student passes the exam if this number is at least 0.55. Suppose we model this experiment by a continuous random variable X, the score, whose probability density function is given by f(x) = { x if 0 <= x < 0.5 5x - 2 if 0.5 <= x <= 1 0 otherwise } a. What is the probability that...
An investment has returned 10%, 1%, -1%, 0%, and 16% in each of the last five...
An investment has returned 10%, 1%, -1%, 0%, and 16% in each of the last five years. If we decide to use historical returns as a proxy for expected future returns, what is the expected rate of return?
A village has six residents, each of whom has accumulated savings of $100. Each villager can...
A village has six residents, each of whom has accumulated savings of $100. Each villager can use this money either to buy a government bond that pays 18 percent interest per year or to buy a year-old llama, send it onto the commons to graze, and sell it after 1 year. The price the villager gets for the 2-year-old llama depends on the quality of the fleece it grows while grazing on the commons. That in turn depends on the...
A village has six residents, each of whom has accumulated savings of $100. Each villager can...
A village has six residents, each of whom has accumulated savings of $100. Each villager can use this money either to buy a government bond that pays 14 percent interest per year or to buy a year-old llama, send it onto the commons to graze, and sell it after 1 year. The price the villager gets for the 2-year-old llama depends on the quality of the fleece it grows while grazing on the commons. That, in turn, depends on the...
A village has six residents, each of whom has accumulated savings of $100. Each villager can...
A village has six residents, each of whom has accumulated savings of $100. Each villager can use this money either to buy a government bond that pays 18 percent interest per year or to buy a year-old llama, send it onto the commons to graze, and sell it after 1 year. The price the villager gets for the 2-year-old llama depends on the quality of the fleece it grows while grazing on the commons. That in turn depends on the...
Bands’End Ltd has 6 shareholders, each of whom is a director involved in the day to...
Bands’End Ltd has 6 shareholders, each of whom is a director involved in the day to day operations of the community. Landed Ltd has only 86 full-time employees each of whom has direct, personal contact with the directors. The financial statements of Bands’ End Ltd for the year ended 30 June 2015 show: Gross assets of $14,500,000 and Gross revenue of $24,001,000. Equity 5.5million Explain, justifying your answer, if Bands’ End Ltd is required by the Corporations Act 2001 to...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT