 <p>You can also keep your code like what it is right now, and split only the results.</p> <p>For example, i assume that your output is:</p> <pre><code>output = ['B3', 'B2', 'C3', 'C2', 'B3', 'A1', 'C2', 'B2', 'C1'] </code></pre> <p>So, you can do something like this:</p> <pre><code>expected_output = [output[i:i+3] for i in range(0, len(output), 3)] print(expected_output) </code></pre> <p>Output:</p> <pre><code>[['B3', 'B2', 'C3'], ['C2', 'B3', 'A1'], ['C2', 'B2', 'C1']] </code></pre> <p>So, in order to edit your code, you have only to edit one line:</p> <p><code>self.results.extend(self.hand)</code> to <code>self.results.extend(self.hand[i:i+3] for i in range(0, len(self.hand), 3))</code></p> <p>So your <code>simple_function()</code> will be:</p> <pre><code>def simple_function(self): for counter in range(0, 3, 1): print("Loop", counter) self.draw(3) print("Hand", simple_cards.hand) # The edited line self.results.extend(self.hand[i:i+3] for i in range(0, len(self.hand), 3)) print("Results before return", simple_cards.results) self.return_hand() print("Results after return", simple_cards.results) print("") </code></pre> <p>Output after the edit:</p> <pre><code>Loop 0 Hand ['B1', 'C1', 'C3'] Results before return [['B1', 'C1', 'C3']] Results after return [['B1', 'C1', 'C3']] Loop 1 Hand ['C1', 'C3', 'A3'] Results before return [['B1', 'C1', 'C3'], ['C1', 'C3', 'A3']] Results after return [['B1', 'C1', 'C3'], ['C1', 'C3', 'A3']] Loop 2 Hand ['C2', 'A3', 'B3'] Results before return [['B1', 'C1', 'C3'], ['C1', 'C3', 'A3'], ['C2', 'A3', 'B3']] Results after return [['B1', 'C1', 'C3'], ['C1', 'C3', 'A3'], ['C2', 'A3', 'B3']] Results after function [['B1', 'C1', 'C3'], ['C1', 'C3', 'A3'], ['C2', 'A3', 'B3']] </code></pre>