I am attempting to make a function that will return the unique numbers of a list, in list form. For example:
l = [1,2,2,3,4]
My function would return: [1,2,3,4]
I used a set to do this, and my code is as follows:
def unique_list(l):
se = set(l)
lis = [se]
return lis
print(unique_list(t))
And my output is: [set([1, 2, 3, 4, 5, 6, 7, 8])]
I would assume it has something to do with the se = set(l)
or lis = [se]
part of my code. However, I am learning by myself and am not exactly sure what could be causing this.