Question: (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 aba.

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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!