Untitled
unknown
plain_text
6 months ago
1.7 kB
6
Indexable
Never
TeamName = ["Team A", "Team B", "Team C"] # Example team names TeamPoints = [[3, 2, 1], # Points for Team A [0, 3, 2], # Points for Team B [1, 1, 2]] # Points for Team C LeagueSize = len(TeamName) # Number of teams in the league MatchNo = len(TeamPoints[0]) # Number of matches played (assuming all teams played same number of matches) TeamCounter = 0 MatchCounter = 0 TotalPoints = [0 for i in range(LeagueSize)] HighestResult = 0 LowestResult = 0 TopTeam = 0 BottomTeam = 0 for TeamCounter in range(0, LeagueSize): TotalPoints[TeamCounter] = 0 #set zero for each club's result details for TeamCounter in range(0, LeagueSize): away = 0 #set zero for each match details #3 home = 0 #2 drawn = 0 #1 lost = 0 # for MatchCounter in range(0,MatchNo): value = TeamPoints[TeamCounter][MatchCounter] TotalPoints[TeamCounter] += value if value ==3: away+=1 if value ==2: home+=1 if value ==1: drawn+=1 if value ==0: lost+=1 print(TeamName[TeamCounter]) print("total points ", TotalPoints[TeamCounter]) print("home wins", home) print("away wins", away) print("drawn matches", drawn) print("lost", lost) print("highest team", TopTeam) print("lowest team", BottomTeam) if TeamCounter==0: LowestResult=TeamPoints[0] HighestResult=TeamPoints[0] if (TeamPoints[TeamCounter])<LowestResult: LowestResult=TeamPoints[TeamCounter] if TeamPoints[TeamCounter]>HighestResult: HighestResult=TeamPoints[TeamCounter] print(HighestResult) print(LowestResult)
Leave a Comment