Check for duplicates in a list

Run Settings
LanguagePython
Language Version
Run Command
some_list = ['a', 'b', 'c', 'b', 'd', 'm', 'n', 'n'] seen = set() duplicates = set() for char in some_list: #loop through chars if char in seen: # if char is present in seen -> add to duplicates duplicates.add(char) seen.add(char) # otherwise if char is not present in seen -> add to seen print(list(duplicates))
Editor Settings
Theme
Key bindings
Full width
Lines