DEV Community

Clarice Bouwer
Clarice Bouwer

Posted on

How to get distinct values in a grid

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.

Top comments (0)

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay