Answer:
Follows are the code to this question:
def Contestant_Score(l):#defining a method Contestant_Score that accepst a list
mi=min(l)#defining mi variable that use min method to hold Lowest value
ma=max(l)#defining ma variable that use max method to hold highest value
y=sum(l)#defining y variable that hold sum of list
x=y-(mi+ma)#defining x variable that exclude mi and ma value
print("Lowest score: ", mi)#print Lowest score
print("highest score: ", ma)#print highest score
print("Calculating average excluding highest and Lowest number: ",x/3)#print average value
l=[9,5,7,4,6]#defining an empty list
Contestant_Score(l)#calling method
Output:
Lowest score: 4
highest score: 9
Calculating average excluding highest and Lowest number: 6.0
Explanation:
In the given code a method "Contestant_Score" is defined that accept a list in its parameter and inside the method three variable "mi, ma, and y" is defined, that uses the "min, max, and sum" to hold a value in a variable.
- In the next step, x variable is defined that exclude the "mi and ma" value from y and calculate its average value and use the print method to print its value.
- Outside the method, a list is defined that holds some value and pass into the method.