def removeContestantsList(self, l, x, sign): algorithm = algorithms.algorithmsClass() med = algorithm.avarageList(l) toDelete = [] for i in range(len(med)): if algorithm.compareNubmer(med[i] * 10, x, sign): toDelete.append(i) return toDelete
def topContestants(self, l, x): algorithm = algorithms.algorithmsClass() order = algorithm.sortTheList(l) toPrint = [] for i in range(1, x + 1): toPrint.append([ order[len(l) - i], l[order[len(l) - i]][0], l[order[len(l) - i]][1], l[order[len(l) - i]][2], (l[order[len(l) - i]][0] + l[order[len(l) - i]][1] + l[order[len(l) - i]][2]) / 3 ]) return toPrint
def createTheSpecificList(self,l,x,sign): algorithm = algorithms.algorithmsClass() med = algorithm.avarageList(l) ok=False toPrint=[] for i in range(len(med)): if algorithm.compareNubmer(med[i]*10, x, sign): toPrint.append(l[i]) ok=True if ok==False: return "There are no such contestants" else: return toPrint
def testSortedListOp(self): algorithm = algorithms.algorithmsClass() assert (algorithm.sortTheList([[3, 3, 3], [2, 2, 2], [4, 4, 4], [1, 1, 1], [5, 5, 5]]) == (3, 1, 0, 2, 4)) try: assert (algorithm.sortTheList([[3, 3, 3], [2, 2, 2], [4, 4, 4], [1, 1, 1], [5, 5, 5]]) == (3, 1, 0, 4, 2)) assert (False) except AssertionError: assert (True) del algorithm
def printSortedList(self,l): algorithm = algorithms.algorithmsClass() order = algorithm.sortTheList(l) for i in range (len(l)): print('Contestant ' , order[i] , ' : ',l[order[i]][0], ' ' ,l[order[i]][1],' ',l[order[i]][2]) del algorithm