"""Module for a single play of the two thirds games"""

class TwoThirdsGame:
    """
    Class for a game
    """
    def __init__(self, data):
        if (type(data) is not list) and (type(data) is not dict):
            raise ValueError('Input must be either a list or a dictionary')
        self.data = data

    def two_thirds_of_the_average(self):
        if type(self.data) is list:
            return 2.0 * sum(self.data) / (3.0 * len(self.data))
        if type(self.data) is dict:
            return 2.0 * sum(self.data.values()) / (3.0 * len(self.data))

    def find_winner(self):
        """
        Returns winning guess if game is generated by list.
        Returns tuples of names who won as well as winning guesses.
        """
        if type(self.data) is list:
            best_guess = min(self.data, key=lambda x: abs(x-self.two_thirds_of_the_average()))
            winning_guessers = ['Anonymous']
        if type(self.data) is dict:
            best_guess = min(self.data.values(), key=lambda x:
                abs(x-self.two_thirds_of_the_average()))
            winning_guessers = [guesser for guesser in self.data if
                    self.data[guesser] == best_guess]
        return tuple(sorted(winning_guessers) + [best_guess])

c1232cc041b4bc3a8cf0fac93bce4f001b598c30
<mask token>


class TwoThirdsGame:
    <mask token>

    def __init__(self, data):
        if type(data) is not list and type(data) is not dict:
            raise ValueError('Input must be either a list or a dictionary')
        self.data = data
    <mask token>
    <mask token>

<mask token>


class TwoThirdsGame:
    <mask token>

    def __init__(self, data):
        if type(data) is not list and type(data) is not dict:
            raise ValueError('Input must be either a list or a dictionary')
        self.data = data
    <mask token>

    def find_winner(self):
        """
        Returns winning guess if game is generated by list.
        Returns tuples of names who won as well as winning guesses.
        """
        if type(self.data) is list:
            best_guess = min(self.data, key=lambda x: abs(x - self.
                two_thirds_of_the_average()))
            winning_guessers = ['Anonymous']
        if type(self.data) is dict:
            best_guess = min(self.data.values(), key=lambda x: abs(x - self
                .two_thirds_of_the_average()))
            winning_guessers = [guesser for guesser in self.data if self.
                data[guesser] == best_guess]
        return tuple(sorted(winning_guessers) + [best_guess])

<mask token>


class TwoThirdsGame:
    <mask token>

    def __init__(self, data):
        if type(data) is not list and type(data) is not dict:
            raise ValueError('Input must be either a list or a dictionary')
        self.data = data

    def two_thirds_of_the_average(self):
        if type(self.data) is list:
            return 2.0 * sum(self.data) / (3.0 * len(self.data))
        if type(self.data) is dict:
            return 2.0 * sum(self.data.values()) / (3.0 * len(self.data))

    def find_winner(self):
        """
        Returns winning guess if game is generated by list.
        Returns tuples of names who won as well as winning guesses.
        """
        if type(self.data) is list:
            best_guess = min(self.data, key=lambda x: abs(x - self.
                two_thirds_of_the_average()))
            winning_guessers = ['Anonymous']
        if type(self.data) is dict:
            best_guess = min(self.data.values(), key=lambda x: abs(x - self
                .two_thirds_of_the_average()))
            winning_guessers = [guesser for guesser in self.data if self.
                data[guesser] == best_guess]
        return tuple(sorted(winning_guessers) + [best_guess])

<mask token>


class TwoThirdsGame:
    """
    Class for a game
    """

    def __init__(self, data):
        if type(data) is not list and type(data) is not dict:
            raise ValueError('Input must be either a list or a dictionary')
        self.data = data

    def two_thirds_of_the_average(self):
        if type(self.data) is list:
            return 2.0 * sum(self.data) / (3.0 * len(self.data))
        if type(self.data) is dict:
            return 2.0 * sum(self.data.values()) / (3.0 * len(self.data))

    def find_winner(self):
        """
        Returns winning guess if game is generated by list.
        Returns tuples of names who won as well as winning guesses.
        """
        if type(self.data) is list:
            best_guess = min(self.data, key=lambda x: abs(x - self.
                two_thirds_of_the_average()))
            winning_guessers = ['Anonymous']
        if type(self.data) is dict:
            best_guess = min(self.data.values(), key=lambda x: abs(x - self
                .two_thirds_of_the_average()))
            winning_guessers = [guesser for guesser in self.data if self.
                data[guesser] == best_guess]
        return tuple(sorted(winning_guessers) + [best_guess])

"""Module for a single play of the two thirds games"""

class TwoThirdsGame:
    """
    Class for a game
    """
    def __init__(self, data):
        if (type(data) is not list) and (type(data) is not dict):
            raise ValueError('Input must be either a list or a dictionary')
        self.data = data

    def two_thirds_of_the_average(self):
        if type(self.data) is list:
            return 2.0 * sum(self.data) / (3.0 * len(self.data))
        if type(self.data) is dict:
            return 2.0 * sum(self.data.values()) / (3.0 * len(self.data))

    def find_winner(self):
        """
        Returns winning guess if game is generated by list.
        Returns tuples of names who won as well as winning guesses.
        """
        if type(self.data) is list:
            best_guess = min(self.data, key=lambda x: abs(x-self.two_thirds_of_the_average()))
            winning_guessers = ['Anonymous']
        if type(self.data) is dict:
            best_guess = min(self.data.values(), key=lambda x:
                abs(x-self.two_thirds_of_the_average()))
            winning_guessers = [guesser for guesser in self.data if
                    self.data[guesser] == best_guess]
        return tuple(sorted(winning_guessers) + [best_guess])
