import math


def cosineSimilarity(v1, v2):
    dotProduct = sum(p * q for p,q in zip(v1, v2))
    magnitude = math.sqrt(sum([val**2 for val in v1])) * math.sqrt(sum([val**2 for val in v2]))
    if not magnitude:
        return 0
    return (dotProduct / magnitude).item()

6dea27fe7fc093b2b2dda153939456bcde9df44b
<mask token>

<mask token>


def cosineSimilarity(v1, v2):
    dotProduct = sum(p * q for p, q in zip(v1, v2))
    magnitude = math.sqrt(sum([(val ** 2) for val in v1])) * math.sqrt(sum(
        [(val ** 2) for val in v2]))
    if not magnitude:
        return 0
    return (dotProduct / magnitude).item()

import math


def cosineSimilarity(v1, v2):
    dotProduct = sum(p * q for p, q in zip(v1, v2))
    magnitude = math.sqrt(sum([(val ** 2) for val in v1])) * math.sqrt(sum(
        [(val ** 2) for val in v2]))
    if not magnitude:
        return 0
    return (dotProduct / magnitude).item()

import math


def cosineSimilarity(v1, v2):
    dotProduct = sum(p * q for p,q in zip(v1, v2))
    magnitude = math.sqrt(sum([val**2 for val in v1])) * math.sqrt(sum([val**2 for val in v2]))
    if not magnitude:
        return 0
    return (dotProduct / magnitude).item()
