Calculate the number of items in a vector that appear at the same index in each vector, with the same value. 

```python
   vector_affinity([1, 2, 3, 4, 5], [1, 2, 2, 4, 3]) # => 0.6
   vector_affinity([1, 2, 3], [1, 2, 3]) # => 1.0
```

Affinity value should be realized on a scale of 0.0 to 1.0, with 1.0 being absolutely identical. Two identical sets should always be evaulated as having an affinity or 1.0.

Hint: The last example test case holds a significant clue to calculating the affinity correctly.

Difficulty: introductory

Starter code:

def vector_affinity(a, b):
	

Solutions:
def vector_affinity(a, b):
  longer = len(a) if len(a) > len(b) else len(b)
  return len([i for i, j in zip(a, b) if i == j]) / float(longer) if longer > 0 else 1.0

def vector_affinity(a, b):
    return sum([1.0 for x, y in zip(a, b) if x == y]) / max(len(a), len(b)) if max(len(a), len(b)) else 1

from itertools import zip_longest, starmap
from statistics import mean
from operator import eq

def vector_affinity(a, b):
    return not (a or b) or mean(starmap(eq, zip_longest(a, b, fillvalue='¯\_(ツ)_/¯')))

def vector_affinity( a, b ):
    sizeA = len(a)
    sizeB = len(b)

    if (sizeA + sizeB) == 0:
        return 1.0

    if sizeA >= sizeB:
        den = sizeA
        numIter = sizeB
    else:
        den =  sizeB
        numIter = sizeA

    numMatch=0

    for i in range(numIter):
        if a[i]==b[i]:
            numMatch+=1

    affinity = numMatch/den

    return affinity
#----end function


def vector_affinity(a, b):
    return 1.0 if a == b else sum(1 for (m, n) in zip(a, b) if m == n) / max(len(a), len(b))

def vector_affinity(*args):
    l1,l2 = list(map(len,args))
    return sum(x==y for x,y in zip(*args)) / (1.0 * (max(l1,l2))) if l1 or l2 else 1.0

def vector_affinity(a, b):
    denom = max(len(a), len(b))
    return sum(l == r for l, r in zip(a, b)) / float(denom) if denom else 1


def vector_affinity(a, b):
    return 1.0 if a == b else sum(1 for i, j in zip(a, b) if i == j) / float(max(len(a), len(b)))

def vector_affinity(a, b):
    return 1.0 if a == b else sum(float(x == y) for x, y in zip(a, b)) / max(len(a), len(b))

def vector_affinity(a, b):
    return sum([an==bn for an,bn in zip(a,b)])/float(max(len(a),len(b))) if len(a) or len(b) else 1