Recommendation System, Content Based Filtering, Collaborative Filtering, Hybrid Recommendation, Naturallanguageprocessing.
X is not a list, or is empty, the function returns an empty list. def get_list(x): if isinstance(x, list): names = [i['name'] for i in x] #Check if more than 3 elements exist. If yes, return only first three. If no, return entire list. if len(names) > 3: names = names[:3] return names #Return empty