Created
August 28, 2022 00:17
-
-
Save gabbyprecious/a172a33bbc643056723526ac511a86dd to your computer and use it in GitHub Desktop.
Tournament Winner DS/AL
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Online Python - IDE, Editor, Compiler, Interpreter | |
Competitors = [ | |
["HTML", "C#"], | |
["C#", "Python"], | |
["Python", "HTML"] | |
] | |
results = [0, 0, 1] | |
def get_winner(comp, res): | |
dictComp = {} | |
team_list = [] | |
for lister in comp: | |
for item in lister: | |
if item not in team_list: | |
team_list.append(item) | |
for team in team_list: | |
dictComp[team] = 0 | |
for index,item in enumerate(comp): | |
winning_team = None | |
losing_team = None | |
if res[index] == 0: | |
winning_team = item[1] | |
losing_team = item[0] | |
else: | |
winning_team = item[0] | |
losing_team = item[1] | |
print(f"{winning_team} beats {losing_team}") | |
dictComp[winning_team] = dictComp.get(winning_team)+ 3 | |
fin_winner = max(dictComp, key=dictComp.get) | |
for key, value in dictComp.items(): | |
print(f"{key} has {value} points") | |
print(f"{fin_winner} won") | |
get_winner(Competitors, results) |
Youngestdev
commented
Aug 28, 2022
Yeahhh just saw that.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment