Question: Write a function isPTrip (a,b) that returns False if a,b are not components of a Pythagorean triplet or returns (True,(a,b,c)) if a,b are components of

Write a function isPTrip (a,b) that returns False if a,b are not components of a Pythagorean triplet or returns (True,(a,b,c)) if a,b are components of a Pythagorean triplet. isPTrip (3,4) should retum (True, (3,4,5)) isPTrip (3,5) should return (True, (3,4,5)) isPTrip(4,5) should return (True, (3,4,5) ) In [ ]: M|def isPTrip(a,b):Ifa>b:a,b=b,aYOURCODEHEREraiseNotImplementedError() In [ ]: M assert isinstance(ispTrip (3,4)[1], tuple) In [ ]: M assert isinstance(ispTrip (3,4)[],b001 ) In [ ]: M assert ispTrip (3,4)==( True, (3,4,5) ) In [ ]: M assert isPTrip (8,15)==( True, (8,15,17)) R OneDrive In [ ]: M assert ispTrip (80,89)==( True, (39,80,89) ) assert ispTrip (3,5)==( True, (3,4,5)) Screenshot saved The screenshot was added to your OneDrive
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
