You will write three functions for vectors given as tuples of three numbers: the cross product, the area of a triangle from its three corners, and a test for parallel vectors. The checker uses the vectors of the lessons.
The idea. The components of the cross product come from the determinant. The triangle has half the size of the cross product of two sides from one corner. Two vectors are parallel when their cross product is the zero vector.
Your tasks.
cross(a, b). Return a tuple of three numbers.triangle_area(P, Q, R). Use the sides from P, and the function cross.is_parallel(a, b). Return True when every component of the cross product is zero.Have you tried it?
Do the tasks in the editor first, and run the checker after each one. Its hints help when a check fails. When you are ready, compare your code with this solution.
Log in to join the discussion.
Loading…