who can help me with exercise 20.3 of Python | Sololearn: Learn to code for FREE!


who can help me with exercise 20.3 of Python

Homework: The Pythagorean theorem says: In a right angled triangle, the square on the side of the hypotenuse is equal to the sum of the squares on the other two sides. Write a program that takes the lengths of the sides of the triangles as inputs and outputs, whether our triangle is right or not. If the triangle is a right angle, the program should return "At Right Angles", and "Not At Right Angles" if it is not. Input example: 3 4 7 output example: Not at right angles Clue: Take the 3rd input (variable side3 in the sample code) as the longest side, which will represent the hypotenuse if the triangle is at right angles. This is my exercise: side1 = int(input()) side2 = int(input()) side3 = int(input()) if (side3 == (side2 + side1)): print("right angled") else: print("Not right-angled")

1/14/2022 5:40:15 PM

Jefferson Jesus Beleño Suarez

7 Answers

New Answer


side1 = int(input()) side2 = int(input()) side3 = int(input()) if (side3 **2 == (side2 + side1)**2): print("At Right Angles") else: print("Not At Right Angles") I advise you to show this video to understand Pythagorean theorem https://www.khanacademy.org/math/cc-eighth-grade-math/cc-8th-geometry/cc-8th-pythagorean-theorem/v/the-pythagorean-theorem if the program requirements need to make function so the following the solution will become side1 = int(input()) side2 = int(input()) side3 = int(input()) def triangle_type(x,y,z): if (z **2 == (x + y)**2): return "At Right Angles" else: return "Not At Right Angles" triangle_type(side1, side2, side 3) Note: You can use Math.pow() instead of using exponent (**) and make sure that you import Math module


Jefferson Jesus Beleño Suarez Right Angle formula a * a + b * b = c * c;


Farmula? Jefferson Jesus Beleño Suarez also if it is code coach excersize, then it expect exact output as mentioned in description (spelling, capitazation,.. Etc).. You are trying to print "right angled", "Not right-angled" , but description says to print - "At Right Angles", "Not At Right Angles".


Thanks. Muhammad A͢J Jayakrishna🇮🇳


Solomoni Railoa I need you help. Please.


You're welcome Jefferson Jesus Beleño Suarez


You're are welcome.. Jefferson Jesus Beleño Suarez