I have a function that finds the unique values of a list, but I can't create a new list with them.
import numpy as np
def unique(list):
x = np.array(list)
print(np.unique(x))
list1 = [10, 20, 10, 30, 40, 40]
unique(list1)
My output are the unique values but I want to create a new list containing them. I thought it would be as simple as bellow but when I print list2 the output says "None". I feel there is a really easy answer but I can't figure it out.
list2 = unique(list1)
print(list2)