Find the distance

Report a typo

We can use the Jaccard distance to find the difference between two objects (sets). It is also used as a complement to the Jaccard similarity. The formula is dj(A,B)=1J(A,B)d_j(A,B) = 1 - J(A,B). Take words as input from two different lines. Calculate the Jaccard distances and print the results. Use spaces when retrieving words from the input.

Sample Input 1:

cat window sister dog
cat sister dog who

Sample Output 1:

0.4
Write a program in Python 3





___

Create a free account to access the full topic