Build an Adjacency List to Matrix Converter - Build an Adjacency List to Matrix Converter

Tell us what’s happening:

I assume that function is giving expected output with all given outside testcases. Not sure, what’s wrong in here?
Can someone help me out here, please?

Your code so far

def adjacency_list_to_matrix(graph):
    matrix = []
    size = len(graph)
    for i in range(size):
        row = [0]*size
        node = graph[str(i)]
        for j in node:
            row[j] = 1
        matrix.append(row)
        print(row)
    return matrix

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:146.0) Gecko/20100101 Firefox/146.0

Challenge Information:

Build an Adjacency List to Matrix Converter - Build an Adjacency List to Matrix Converter

How could you confirm, if function returns what’s expected?

I had passed the given test cases and checked in the output window

That’s weird, when I try one of the cases, I’m getting KeyError

print(adjacency_list_to_matrix({0: [1, 2], 1: [2], 2: [0, 3], 3: [2]}))
Traceback (most recent call last):
  File "main.py", line 14, in <module>
  File "main.py", line 6, in adjacency_list_to_matrix
KeyError: '0'

My bad !!
I made my dictionary keys as string while working on my system and then used str() to access them. Not the same case with given test cases.
Neverthless, I passed all the test cases after changing them to int.
Thanks