
Neha P. answered 02/19/20
Experienced professional teaching software and math
This is my first python program so it goes with the basics hope it helps with the results you are looking for.
game_num = 0
results = []
w1=0
w2=0
while game_num < 5:
score1 = int(input("Enter the score that team 1 got on match {} -\n".format(game_num+1)))
score2 = int(input("Enter the score that team 2 got on match {} -\n".format(game_num+1)))
if score1>score2:
winner = "Team 1"
w1 += 1
elif score2>score1:
winner = "Team 2"
w2 += 1
else:
winner = "Tie"
subresults = ["Match " + str(game_num+1), score1,score2,winner]
results.append(subresults)
game_num += 1
print(" ","Team1 ", "Team2", " Winner")
game_num = 0
while game_num < 5:
print(results[game_num][0]," ",results[game_num][1] ," ",results[game_num][2]," ",results[game_num][3])
game_num +=1
if w2 > w1:
print ('\nThe Winner is Team 2')
elif w1>w2:
print ('\nThe Winner is Team 1')
else:
print('\nThe game was a Tie')
Samantha R.
Thanks!02/22/20