Write a python code that do the following Ask the user for t
Solution
# Program starts here.
#scoresList is list to hold numbers
scoresList = list()
nb = int(input(\'Enter the number of scores: \'))
# get all the scores from the user.
while(nb > 0):
score = int(input(\'Enter the score: \'))
# Check if the score is already in the list.
# if yes, do not append.
if score in scoresList:
tmp = scoresList.index(score)
print \"This score is already in list. The corresponding index is: \" + str(tmp)
else:
scoresList.append(score)
nb = nb - 1;
# sort the list.
scoresList.sort()
print \"The scores in the sorted list are: \"
print scoresList
# find min, max, sum and average
minElement = min(scoresList)
maxElement = max(scoresList)
listSum = sum(scoresList)
listAverage = listSum/len(scoresList)
print \"Max element in the list: \" + str(maxElement)
print \"Min element in the list: \" + str(minElement)
print \"Sum of all elements in the list: \" + str(listSum)
print \"Average of all elements in the list: \" + str(listAverage)
replaceNumber = input(\'Do you want to replace any values in list? (y for yes OR n for no) \')
if replaceNumber == \'y\':
oldvalue = int(input(\'Enter the value to replace: \'))
newvalue = int(input(\'Enter the new value: \'))
tmp = scoresList.index(oldvalue)
scoresList.insert(tmp,newvalue)
