Generation

generate functionSat, 12 Nov 2022

Compare 2 databases sets for duplicates

def compare(db1, db2): # return whether there are duplicate records in both db1 and db2 # len(set(db1) & set(db2)) > 0 # return whether there are duplicate records in both db1 and db2 # return set(db1) & set(db2) # return whether there are duplicate records in both db1 and db2 # return list(set(db1) & set(db2)) # return whether there are duplicate records in both db1 and db2 return len(list(set(db1) & set(db2))) > 0 print(compare([1, 2, 3], [3, 4, 5])) # True print(compare([1, 2, 3], [1, 4, 5])) # True print(compare([1, 2, 3], [2, 3, 4])) # True print(compare([1, 2, 3], [5, 6, 7])) # False print(compare([1, 2, 3

Want to kickstart your project?Use the new AI Studio to create your code