MCPcopy Create free account
hub / github.com/TheAlgorithms/Python / vector_product

Function vector_product

project_euler/problem_102/sol1.py:27–35  ·  view source on GitHub ↗

Return the 2-d vector product of two vectors. >>> vector_product((1, 2), (-5, 0)) 10 >>> vector_product((3, 1), (6, 10)) 24

(point1: tuple[int, int], point2: tuple[int, int])

Source from the content-addressed store, hash-verified

25
26
27def vector_product(point1: tuple[int, int], point2: tuple[int, int]) -> int:
28 """
29 Return the 2-d vector product of two vectors.
30 >>> vector_product((1, 2), (-5, 0))
31 10
32 >>> vector_product((3, 1), (6, 10))
33 24
34 """
35 return point1[0] * point2[1] - point1[1] * point2[0]
36
37
38def contains_origin(x1: int, y1: int, x2: int, y2: int, x3: int, y3: int) -> bool:

Callers 1

contains_originFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected