def jaccard_set(list1, list2): """Define Jaccard Similarity function for two sets""" intersection = len(list(set(list1).intersection(list2))) union = (len(list1) + len(list2)) - intersection return float(intersection) / union # Define two sets a = [0, 1, 3, 4, 6] b = [0, 2, 3, 4, 5, 6, 8] # Find Jaccard Similarity between the two sets jaccard_set(a, b)