In: Computer Science
Two numbers a and b are called pythagorean pair if both a and b are integers and there exists an integer c such that a2 + b2 = c2. Write a function pythagorean_pair(a,b) that takes two integers a and b as input and returns True if a and b are pythagorean pair and False otherwise.
def pythagorean_pair(a,b): c = (a*a + b*b) ** 0.5 return c ** 2 == int(c) ** 2 print(pythagorean_pair(3, 4)) print(pythagorean_pair(6, 7)) print(pythagorean_pair(6, 8))
************************************************** Thanks for your question. We try our best to help you with detailed answers, But in any case, if you need any modification or have a query/issue with respect to above answer, Please ask that in the comment section. We will surely try to address your query ASAP and resolve the issue.
Please consider providing a thumbs up to this question if it helps you. by Doing that, You will help other students, who are facing similar issue.