How to Check if Array/List Contains Duplicate Numbers or Strings in Python using Set?
In Python, we can check if an array or list contains duplicate items using the following one-liner function. def contain_duplicates(list): return len(set(list)) != len(list) The idea is to convert …