Pythagorean Triplet Finder

Easy
10
85.0% Acceptance

In this lab, you are tasked to write a Python function named is_pythagorean_triplet that takes a list of three numbers and determines whether they can form a Pythagorean triplet. A Pythagorean triplet consists of three positive integers ( a ), ( b ), and ( c ), such that ( a^2 + b^2 = c^2 ).

Your function should:

  • Return True if the numbers form a Pythagorean triplet.
  • Return False if the numbers do not form a Pythagorean triplet.
  • Raise a ValueError with the message "List must contain exactly three numbers" if the input list does not contain exactly three numbers.

Examples:

  1. For an input list [3, 4, 5], your function should return True as ( 3^2 + 4^2 = 5^2 ).

  2. For an input list [10, 5, 24], your function should return False as ( 10^2 + 5^2 != 24^2 ).

Please ensure your function handles different permutations of the input list and validates the input size correctly.