import numpy as np
def unique(list1):
npArray1 = np.array(list1)
uniqueNpArray1 = np.unique(npArray1)
return uniqueNpArray.tolist()
list1 = [10, 20, 10, 30, 40, 40]
unique(list1) # [10, 20, 30, 40]
"""Generation of unique random list of size n
"""
from random import sample
def unique_lst(n):
return sample(range(10, 100), n) # return a sample of lst (unique lst)
# print(unique_lst(10))
list(dict.fromkeys(list_with_duplicates))