コード例 #1
0
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)
コード例 #2
0
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)
コード例 #3
0
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)
コード例 #4
0
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)
コード例 #5
0
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)
コード例 #6
0
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
コード例 #7
0
ファイル: project3.py プロジェクト: shafaypro/shafayworkspace
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
コード例 #8
0
ファイル: project3.py プロジェクト: shafaypro/shafayworkspace
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)