Learn Classes and Objects by Building a Sudoku Solver - Step 14

Tell us what’s happening:

I don’t know what is needed to complete this step

Your code so far

class Board:
    def __init__(self, board):
        self.board = board

    def __str__(self):
        upper_lines = f'\n╔═══{"╤═══"*2}{"╦═══"}{"╤═══"*2}{"╦═══"}{"╤═══"*2}╗\n'
        middle_lines = f'╟───{"┼───"*2}{"╫───"}{"┼───"*2}{"╫───"}{"┼───"*2}╢\n'
        lower_lines = f'╚═══{"╧═══"*2}{"╩═══"}{"╧═══"*2}{"╩═══"}{"╧═══"*2}╝\n'
        board_string = upper_lines

        for index, line in enumerate(self.board):
            row_list = []

# User Editable Region

            for square_no, part in enumerate([line[:3], line[3:6], line[6:]], start=1):
                for item in part:
                    "|".join(str(item))
                    
                

# User Editable Region

Your browser information:

User Agent is: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36

Challenge Information:

Learn Classes and Objects by Building a Sudoku Solver - Step 14

1 Like

Welcome to the forum @islamqasimov

You almost got it.

The for loop needs to be a part of the .join method.

Happy coding

1 Like

Hi! I have the same code but it doesn’t pass. It says: " You should call str() on each element in part using a generator expression"
Could you please explain the indentation for this for loop? is it part of the previous nested for loop or outside?

Please create your own topic to ask for help

If you have a question about a specific challenge as it relates to your written code for that challenge and need some help, click the Ask for Help button located on the challenge (it looks like a question mark). This button only appears if you have tried to submit an answer at least three times.

The Ask for Help button will create a new topic with all code you have written and include a link to the challenge also. You will still be able to ask any questions in the post before submitting it to the forum.

Thank you.

1 Like

Thanks! I solved it :slight_smile:

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.