All problems
Vector Cross Product
Problem
Compute the cross product of two 3D vectors a and b:
c = [a[1]*b[2] - a[2]*b[1], a[2]*b[0] - a[0]*b[2], a[0]*b[1] - a[1]*b[0]]
Test cases
case 1
in: [[1,0,0],[0,1,0]]
expected: [0,0,1]
case 2
in: [[1,2,3],[4,5,6]]
expected: [-3,6,-3]
case 3
in: [[2,0,0],[0,3,0]]
expected: [0,0,6]
Starter codePython
def cross(a, b):
# Your code here
pass3 test cases · run your code against them in the editor