How to get distinct values in a grid

Clarice Bouwer - Jun 29 '23 - - Dev Community
def get_distinct_values(values):
    return list(set(filter(lambda x: x != 0, values)))
Enter fullscreen mode Exit fullscreen mode

This code will get a distinct list where values are not equal to zero. I used this code in a Sudoku solver algorithm.

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .