Posted on 28th April 2025| views
You can count the number of unique values within the list just by using set() and len() just like this
x_list = [1, 1, 2, 2, 3, 4, 4]
x_set = set(x_list)
unique_values = len(x_set)
print(unique_values)
Output:
4