Retrieving classes in a list by variable name

Hello, I’ve been working on a Tic Tac Toe game as a first project using classes. However I seem to be hung up on trying to get the program to call variables from a specific list.

I’m dealing with two classes, one is the player class and the other is the game class. The Game class creates a list for the players which will become a part of the game loop to cycle the players turns through. So the Game Class has a startGame module which creates two players and names them then appends each to a list; of course this list just lists the objects location in memory so the Player class has a repr that sets their names correctly, I can print this out and the names are correct, but when I try to run the checkWin method it refuses to cooperate even as I use the .index method to retrieve their index’s. I’m rather lost at this point. I’m sure there’s otehr ways I could implement this and may end up doing that, but at the moment, for the sake of my own education I would like to try to figure out how to retrieve class objects from a list this way - or whatever way it’s possibel to do so.

Also my Code:

class Player():

#Players include all the critical information for each individual player

def __init__(self, team, win=False):

    #team defines which peice the player is using x or o

    self.team = team

    #win prvents the other player from begining their turn after a player has won, defaults to False

    self.win = win

def __repr__(self):

    title = "Player" + self.team.upper()

    return title

#allows the player to change a space to their team

def play(pos, team):

    Board.setSpace(pos, team)

class Game():

#The game contains the specific information for the board, the individual players and runs the game loop.

def __init__(self, board=[], players=[]):

    self.board = board

    self.players = players

#Contains the instructions to start a new game

def startGame(self):

    GameBoard = Board()

    PlayerX = Player("x")

    PlayerO = Player("o")

    self.board = GameBoard

    self.players.append(PlayerX)

    self.players.append(PlayerO)

#Checks the board for win conditions and reports and sets a player as the winner.

def checkWin(self):

    if self.board.nw == "o" or "x":

        if self.board.n == "o" or "x":

            if self.board.ne == "o" or "x":

                if self.board.ne == "o" and self.board.n == "o" and self.board.nw == "o":

                    winner = self.players.index(PlayerO)

                    print("Congratulations Player O, you have one the game!")

                if self.board.ne == "x" and self.board.n == "x" and self.board.nw == "x":

                    winner = self.players.index(PlayerX)

                    print("Congratulations Player X, you have one the game!")

        if self.board.w == "o" or "x":

            if self.board.sw == "o" or "x":

                if self.board.nw == "o" and self.board.w == "o" and self.board.sw == "o":

                    winner = self.players.index(PlayerO)

                    print("Congratulations Player O, you have one the game!")

                if self.board.nw == "x" and self.board.w == "x" and self.board.sw == "x":

                    winner = self.players.index(PlayerX)

                    print("Congratulations Player X, you have one the game!")

        if self.board.c == "o" or "x":

            if self.board.se == "o" or "x":

                if self.board.nw == "o" and self.board.c == "o" and self.board.se == "o":

                    winner = self.players.index(PlayerO)

                    print("Congratulations Player O, you have one the game!")

                if self.board.nw == "x" and self.board.c == "x" and self.board.se == "x":

                    winner = self.players.index(PlayerX)

                    print("Congratulations Player X, you have one the game!")

    if self.board.n == "o" or "x":

        print("n checks")

        if self.board.c == "o" or "x":

            print("c checks")

            if self.board.s == "o" or "x":

                print("s checks")

                if self.board.n == "o" and self.board.c == "o" and self.board.s == "o":

                    winner = self.players.index(PlayerO)

                    print("Congratulations Player O, you have one the game!")

                if self.board.n == "x" and self.board.c == "x" and self.board.s == "x":

                    winner = self.players.index(PlayerX)

                    print("Congratulations Player X, you have one the game!")

    if self.board.ne == "o" or "x":

        if self.board. e == "o" or "x":

            if self.board.se == "o" or "x":

                if self.board.ne == "o" and self.board.e == "o" and self.board.se == "o":

                    winner = self.players.index(PlayerO)

                    print("Congratulations Player O, you have one the game!")

                if self.board.ne == "x" and self.board.e == "x" and self.board.se == "x":

                    winner = self.players.index(PlayerX)

                    print("Congratulations Player X, you have one the game!")

    if self.board.w == "o" or "x":

        if self.board.c == "o" or "x":

            if self.board.e == "o" or "x":

                if self.board.w == "o" and self.board.c == "o" and self.board.e == "o":

                    winner = self.players.index(PlayerO)

                    print("Congratulations Player O, you have one the game!")

                if self.board.w == "x" and self.board.c == "x" and self.board.e == "x":

                    winner = self.players.index(PlayerX)

                    print("Congratulations Player X, you have one the game!")

    if self.board.sw == "o" or "x":

        if self.board.s == "o" or "x":

            if self.board.se == "o" or "x":

                if self.board.sw == "o" and self.board.s == "o" and self.board.se == "o":

                    winner = self.players.index(PlayerO)

                    print("Congratulations Player O, you have one the game!")

                if self.board.sw == "x" and self.board.s == "x" and self.board.se == "x":

                    winner = self.players.index(PlayerX)

                    print("Congratulations Player X, you have one the game!")

        if self.board.c == "o" or "x":

            if self.board.ne == "o" or "x":

                if self.board.sw == "o" and self.board.c == "o" and self.board.ne == "o":

                    winner = self.players.index(PlayerO)

                    print("Congratulations Player O, you have one the game!")

                if self.board.sw == "x" and self.board.c == "x" and self.board.ne == "x":

                    winner = self.players.index(PlayerX)

                    print("Congratulations Player X, you have one the game!")

#Turns represent the game loop, requesting information from the players and checking if there's been a win.

#def Turn():