# Task
 Your task is to find the similarity of given sorted arrays `a` and `b`, which is defined as follows: 
 
 you take the number of elements which are present in both arrays and divide it by the number of elements which are present in at least one array.

 It also can be written as a formula `similarity(A, B) = #(A ∩ B) / #(A ∪ B)`, where `#(C)` is the number of elements in C, `∩` is intersection of arrays, `∪` is union of arrays.

 This is known as `Jaccard similarity`.

 The result is guaranteed to fit any floating-point type without rounding.

# Example

 For `a = [1, 2, 4, 6, 7]` and `b = [2, 3, 4, 7]`:
```
elements [2, 4, 7] are present in both arrays;
elements [1, 2, 3, 4, 6, 7] are present in at least one of the arrays.
So the similarity equals to 3 / 6 = 0.5.```

# Input/Output


 - `[input]` integer array `a`

  A `sorted` array of positive integers. 
  
  All elements are `different` and are `less than 100`.
  
  `1 ≤ a.length ≤ 100`


 - `[input]` integer array `b`

  An array in the same format as `a`.


 - `[output]` a float number

  The similarity of the arrays.
  
  ```Haskell
  
  In Haskell the two arrays are passed as a touple.
  ```

Source: codewars | Difficulty: EASY
Tags: Ad-hoc

Starter code: def similarity(a, b):
	

Solutions:
def similarity(a, b):
	try:
		return len(set(a) & set(b)) / len(set(a) | set(b))
	except:
		return 0


def similarity(*args):
	(a, b) = map(set, args)
	return len(a & b) / len(a | b)


def similarity(a, b):
	c = a + b
	lst1 = []
	lst2 = []
	for i in set(c):
		if c.count(i) > 1:
			lst1.append(i)
			lst2.append(i)
		else:
			lst2.append(i)
	return len(lst1) / len(lst2)


def similarity(a, b):
	(a, b) = (set(tuple(a)), set(tuple(b)))
	return len(a.intersection(b)) / len(a.union(b))


def similarity(a, b):
	(a, b) = (set(list(a)), set(list(b)))
	return len(a.intersection(b)) / len(a.union(b))


def similarity(a, b):
	(a, b) = (set(a), set(b))
	return len(a & b) / len(a | b)


def similarity(a, b):
	(sa, sb) = (set(a), set(b))
	return len(sa & sb) / len(sa | sb)


def similarity(a, b):
	x = list(set(a + b))
	z = [num for num in a if num in a and num in b]
	try:
		return len(z) / len(x)
	except ZeroDivisionError:
		return 0