0
def main():
    # Ensure correct usage
    if len(sys.argv) != 2:
        sys.exit("Usage: python tournament.py FILENAME")

    teams = []
    # TODO: Read teams into memory from file
    with open(sys.argv[1]) as file:
        tm = csv.DictReader(file)
        for team in tm:
            team["rating"] = int(team["rating"])
            teams.append(team)

    counts = {}
    # TODO: Simulate N tournaments and keep track of win counts
    for i in range(N):
        winner = simulate_tournament(teams)
        print(winner)


def simulate_tournament(teams):
    """Simulate a tournament. Return name of winning team."""
    # TODO
    if len(teams) == 1:
        print(teams)
        return teams
    else:
        simulate_tournament(simulate_round(teams))

Above is the function simulate_tournament which is supposed to return one team from the list of teams but when I call the function in main and try to access its return I always get None

I tried saving the return of simulate_tournament() in a new list and returning it but I would always get None also

Tom McLean
  • 5,583
  • 1
  • 11
  • 36
Trying90
  • 1
  • 1

0 Answers0