Untitled
unknown
plain_text
2 years ago
1.8 kB
6
Indexable
TeamName = ["Team A", "Team B", "Team C"] # Example team names
TeamPoints = [[3, 2, 0], # Points for Team A
[0, 3, 3], # 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)
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):
wins = 0 #set zero for each match details #3
home = 0 #2
drawn = 0 #1
lost = 0 #0
for MatchCounter in range(0, MatchNo):
matchScore = TeamPoints[TeamCounter][MatchCounter]
TotalPoints[TeamCounter] = TotalPoints[TeamCounter] + matchScore
if matchScore == 0:
lost += 1
elif matchScore == 1:
drawn += 1
elif matchScore == 2:
home += 1
elif matchScore == 3:
wins += 1
# Output details of a team’s results
print("Team Name:", TeamName[TeamCounter])
print("Total Points:", TotalPoints)
print("Wins:", wins)
print("Home:", home)
print("Drawn:", drawn)
print("Lost:", lost)
lowest = 0
highest = 0
for i in range(0, 3):
if TeamCounter == 0:
highest = TotalPoints[i]
lowest = TotalPoints[i]
if TotalPoints[TeamCounter] > highest:
highest = TotalPoints[i]
if TotalPoints[TeamCounter] < lowest:
lowest = TotalPoints[i]
print("")
print("The team with the highest total points is:",highest)
print("The team with the lowest total point is:",lowest)Editor is loading...
Leave a Comment