Take a look a the function below. The order is mixed up. Sort the code to make it run. When sorting, you should first calculate the union.
The Jaccard similarity index
A mixed-up function
Report a typo
Reorder lines using drag or arrows. Adjust indentation with left buttons
union = set_1.union(set_2)
set_1 = set(list_1)
return len(intersection) / len(union)
intersection = set_1.intersection(set_2)
def jaccard_similarity(list_1, list_2):
set_2 = set(list_2)
___
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.
Create a free account to access the full topic
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.