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

Tell us what’s happening:

Describe your issue in detail here.
I’m not sure I understand the instructions given here, As it is, the language has seemed ambiguous on many occasions.

The instructions:

Step 14

Now, you would join the elements of the segment (part) with the pipe character (|).

For that, first, use a for loop for item in part to access all elements.

Then, use the join() method on the | character to join the elements of the segment (part).

After that, convert each element to a string using str(item)

Your code so far

for square_no, part in enumerate([line[:3], line[3:6], line[6:]], start=1):
            for item in part:
                item.join("|")
                str(item)   
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:
                item.join("|")
                str(item)   

/* User Editable Region */

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:121.0) Gecko/20100101 Firefox/121.0

Challenge Information:

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

You appear to have created this post without editing the template. Please edit your post to Tell us what’s happening in your own words.

Solved this already.

2 Likes

how did u solve it ? cant seem to pass this test, im trying

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

but doesnt seem to work, its weird no assignign the values to anything but i guess you do that on the next step ?

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.

I won’t start a new topic since the issue is the same. My code so far is:

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

What’s missing?

Start a new topic please