I want to create a function that take a lsit as argument, for example:
list = ['a','b','a','d','e','f','a','b','g','b']
and returns a specific number of list elements ( i chose the number) such that no number occurs twice. For example if i chose 3:
 new_list = ['a','b','d']
I tried the following:
def func(j, list):
    new_list=[]
    for i in list:
        while(len(new_list)<j):
            for k in new_list:
                if i != k:
                    new_list.append(i)
                    
                    return new_list
But the function went through infinite loop.
 
     
     
     
     
    