![]() |
Comparisons with functions - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: Comparisons with functions (/thread-27446.html) |
Comparisons with functions - menator01 - Jun-07-2020 If I have a function with some values that I defined in the function, how would i go about getting those values out to be check against. I know I can return values, just not sure with this setup. Any guidance much appreciated. Some other stuff above check = ['x','x','x'] for value in self.possible(): if check in value: do stuff def possible(self): # Rows self.row1 = [self.grid[0], self.grid[1], self.grid[2]] self.row2 = [self.grid[3], self.grid[4], self.grid[5]] self.row3 = [self.grid[6], self.grid[7], self.grid[8]] # Columns self.col1 = [self.grid[0], self.grid[3], self.grid[6]] self.col2 = [self.grid[1], self.grid[4], self.grid[7]] self.col3 = [self.grid[2], self.grid[5], self.grid[8]] # Diagonals self.diag1 = [self.grid[0], self.grid[4], self.grid[8]] self.diag2 = [self.grid[2], self.grid[4], self.grid[6]] I figured it out. I made a list with the values and returned them. I must be getting tired. RE: Comparisons with functions - Gribouillis - Jun-07-2020 If it is solved, you can mark the thread as solved! |