def test2SortTable(): pointsTable = [['Bangladesh', 1], ['Brazil', 4], ['Panama', 6], ['Argentina', 4]] pointsTable = sortTable(pointsTable, 1, 0, len(pointsTable) - 1, 'descending') for p in pointsTable: print(p)
def test2SortTable(): pointsTable = [['Bangladesh', 1], ['Brazil', 4], ['Panama', 6], ['Argentina', 4]] pointsTable = sortTable(pointsTable, 1, 0, len(pointsTable)-1, 'descending') for p in pointsTable: print (p)
def test1SortTable(): rankTable = [['Brazil', 6, 1], ['Bangladesh', 6, 1], ['Panama', 6, 1], ['Argentina', 0, 4]] rankTable = sortTable(rankTable, 0, 0, 2, 'ascending') for r in rankTable: print (r)
def test1SortTable(): rankTable = [['Brazil', 6, 1], \ ['Bangladesh', 6, 1], \ ['Panama', 6, 1], \ ['Argentina', 0, 4]] rankTable = sortTable(rankTable, 0, 0, 2, 'ascending') for r in rankTable: print (r)
def addRankToPointsTable(pointsTable): Points = len(pointsTable) Add = sortTable( pointsTable, 0, 1, Points - 1, 'descending') # this is sorting the table in the decending order for i in range(len(pointsTable)): Add[i].append(i + 1) # Add list is being append with the values return breakTies(Add)
def breakTies(rankTable): rank = len(rankTable) rankTableTieBreaker = sortTable(rankTable, 0, 1, 2, 'ascending') for i in range(len(rankTable)): rankTable[i][2] = i + 1 # this is the sub list access of ith element return rankTableTieBreaker
def breakTies(rankTable): rank = len(rankTable) rankTableTieBreaker = sortTable(rankTable,0, 1, 2, 'ascending') for i in range(len(rankTable)): rankTable[i][2] = i + 1 # this is the sub list access of ith element return rankTableTieBreaker
def addRankToPointsTable(pointsTable): Points = len(pointsTable) Add = sortTable(pointsTable, 0, 1, Points - 1, 'descending') # this is sorting the table in the decending order for i in range(len(pointsTable)): Add[i].append(i + 1) # Add list is being append with the values return breakTies(Add)