Extended. You will write a magnitude function, and search for the vectors with whole-number magnitude.
Your tasks.
magnitude, return the magnitude of the vector v. Use sqrt.triples to the list of pairs (x, y) with whose vector has a whole-number magnitude. Go through x in the outer loop and y in the inner loop.longest to the largest magnitude in that list.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…