Answered step by step
Verified Expert Solution
Question
1 Approved Answer
(Plese help! with Coding in python3) Integer Right Triangles Given a perimeter of 60, we can find two right triangles with integral length sides: [(10,
(Plese help! with Coding in python3)
Integer Right Triangles
Given a perimeter of 60, we can find two right triangles with integral length sides: [(10, 24, 26), (15, 20, 25)]. Complete the following function, which takes an integer p and returns a list of tuples (a, b, c) corresponding to the integral lengths of the sides of comforming right triangles. Each tuple should have ab
def integer_right_triangles(p): # YOUR CODE HERE raise NotImplementedError()
# (1 point) import unittest tc = unittest.TestCase() tc.assertEqual(integer_right_triangles(60), [(10, 24, 26), (15, 20, 25)])
# (3 points) import unittest tc = unittest.TestCase() tc.assertEqual(integer_right_triangles(100), []) tc.assertEqual(integer_right_triangles(180), [(18, 80, 82), (30, 72, 78), (45, 60, 75)]) tc.assertEqual(integer_right_triangles(840), [(40, 399, 401), (56, 390, 394), (105, 360, 375), (120, 350, 370), (140, 336, 364), (168, 315, 357), (210, 280, 350), (240, 252, 348)])
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started