Problem creating a function from a piece of code

Dear community, I have tried to create a function based on the search duplicate section in the self guided project, but apparently the function is not giving any outputs. Appreciate any guidance thank you!

#Indentifies all the duplicates in google_data
unique_app = []
duplicate_app = []

for row in google_data:
    app_name = row[0]
    if app_name in unique_app:
        duplicate_app.append(app_name)
    else:
        unique_app.append(app_name)
        
print(duplicate_app[0:10])
print('\n')
print(len(duplicate_app))
['Quick PDF Scanner + OCR FREE', 'Box', 'Google My Business', 'ZOOM Cloud Meetings', 'join.me - Simple Meetings', 'Box', 'Zenefits', 'Google Ads', 'Google My Business', 'Slack']
1180
def identify_duplicates(dataset, index):

    unique_value = []
    duplicate_value = []

    for row in dataset:
        value = row[index]
        if value in unique_value:
            duplicate_value.append(value)
        else:
            unique_app.append(value)
        
    print(duplicate_value[0:10])
    print('\n')
    print("Number of duplicates: ", len(duplicate_value))
    
identify_duplicates(google_data, 0)
[]
Number of duplicates:  0

Take a closer look at your else statement!

3 Likes