I am building a code that needs to find the average of a set of scores in a list that can have amounts added and removed. I know how to find the average of a list of scores of a fixed number can someone help me on how to find the average if my list were to increase or decrease by an amount. Also i was wondering how to print the highest and lowest scores in this list. Thank you for any and all help.
solved thanks though
score = [10,10,9,9,6,5,2,1,0] choice = None while choice != 0: print \ (""" Class Scores 1 - Add a Score 2 - Remove a Score 3 - Average Score 4 - High and Low Score 5 - All Scores 0 - Exit """) choice = float(input("Choice:")) if choice == 0: print ("Goodbye.") elif choice == 1: scores = int(input(("What score do you want to add?"))) score.append(scores) print (score) elif choice == 2: scores = int(input("What score do you want to remove?")) score.remove(scores) print (score) elif choice == 3: ttl = sum(score) print(ttl/len(score)) elif choice == 4: score.sort() score.reverse() end = len(score) print ("Highest scoreis:",score,"Lowest score is:",score[end-1]) elif choice == 5: for score in score: print(score) else: print ("Not a valid choice!")