How do you find the similarity of tuples, as a fraction, in python?
Question: For instance, if I had the tuples (1,2) and (3,2) in python, is there any way
to have a program return 0.5 or 1/2? I've searched but haven't been able to
find anything.


Answer: 
    >>> a = (1, 2)
    >>> b = (3, 2)
    >>> sum(x == y for x, y in zip(a, b)) / float(len(a))
    0.5
    

The `float()` call is only necessary on Python 2.x, to avoid the integer
division. Alternatively you could use `from __future__ import division` at the
top of your file.

