I have two lists with usernames and I want to calculate the Jaccard similarity. Is it possible? 

[This](https://stackoverflow.com/questions/11911252/python-jaccard-distance-using-word-intersection-but-not-character-intersection) thread shows how to calculate the Jaccard Similarity between two strings, however I want to apply this to two lists, where each element is one word (e.g., a username).
['https://Stackoverflow.com/questions/46975929', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/873309/']
@Aventinus (I also cannot comment): Note that Jaccard *similarity* is an operation on sets, so in the denominator part it should also use sets (instead of lists). So for example `jaccard_similarity('aa', 'ab')` should result in `0.5`. 

```
def jaccard_similarity(list1, list2):
    intersection = len(set(list1).intersection(list2))
    union = len(set(list1)) + len(set(list2)) - intersection

    return intersection / union

```

Note that in the intersection, there is no need to cast to list first. Also, the cast to float is not needed in Python 3.
Creator of the [Simphile NLP text similarity](https://github.com/brianrisk/simphile) package here. Simphile contains several text similarity methods, Jaccard being one of them.

In the terminal install the package:

```
pip install simphile

```

Then your code could be something like:

```
from simphile import jaccard_list_similarity

list_a = ['cat', 'cat', 'dog']
list_b = ['dog', 'dog', 'cat']

print(f"Jaccard Similarity: {jaccard_list_similarity(list_a, list_b)}")

```

The output being:

```
Jaccard Similarity: 0.5

```

Note that this solution accounts for repeated elements -- critical for text similarity; without it, the above example would show 100% similarity due to the fact that both lists as sets would reduce to {'dog', 'cat'}.