Compute cosine similarity using pure Python arithmetic.
Constraints
Example
>>> cosine_similarity([1, 2, 3], [1, 2, 3]) 1.0 >>> cosine_similarity([1, 0], [0, 1]) 0.0 >>> cosine_similarity([1, -1], [-1, 1]) -1.0 >>> cosine_similarity([0, 0], [5, 5]) 0.0
Recent Submissions
No submissions yet — hit Run Tests to try!
Hints