import sys from Team import * from Game import * def pct_to_str(pct): if pct == 1.0: return "1.000" pct = pct * 1000 return "0."+str(int(pct)) # this method should read data from games.dat and create Game objects # it should also read data from teams.dat and create Team objects # the Team objects should be placed in a dictionary with team code as key # Team object as value. the method should also make all pointer connections # It shoud return the teams dictionary def read_data(dname): teams = {} pass return teams def main(): teams = read_data(sys.argv[1]) standings = [] for tcd in teams: wlt = teams[tcd].wins_losses_ties() standings.append((wlt[0],tcd,wlt[1],wlt[2],wlt[3])) standings = sorted(standings,reverse=True) print() print("LEAGUE STANDINGS") print() print("TEAM","WINS","LOSSES","TIES","PCT".rjust(7)) print("-----------------------------") for st in standings: print(st[1].ljust(4),str(st[2]).rjust(4),str(st[3]).rjust(6),str(st[4]).rjust(4),pct_to_str(st[0]).rjust(7)) print("-----------------------------") print() main()