In: Computer Science
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:
The last two functions, described below, should be called by calcScore, which uses the returned information to determine which of the scores to drop.
Input Validation: Do not accept judge scores lower than 0 and higher than 10.
General Restrictions:
#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:
