CodeSolved

Solved Programming Questions & Exercises

Pythagorean Relationship

Practice Easy 204/ Download 1395 Views

Write a program that captures the size of the 2 sides of the triangle and examines whether the Pythagorean relationship is in the triangle (the triangle is the vertical triangle) or not? To specify the chord if in the event of

Pythagorean Relationship: (Power to power 2) + (Haghter 2) = (Chord with power 2)

11 Answers

This answer is only visible to premium members
This answer is only visible to premium members
This answer is only visible to premium members
let msg = 'error'
alert(msg) 
This answer is only visible to premium members
This answer is only visible to premium members

This answer is only visible to premium members

Subscription is currently unavailable.
This answer is only visible to premium members
This answer is only visible to premium members
This answer is only visible to premium members
let msg = 'error'
alert(msg) 
This answer is only visible to premium members
This answer is only visible to premium members

This answer is only visible to premium members

Subscription is currently unavailable.
This answer is only visible to premium members
This answer is only visible to premium members
This answer is only visible to premium members
let msg = 'error'
alert(msg) 
This answer is only visible to premium members
This answer is only visible to premium members

This answer is only visible to premium members

Subscription is currently unavailable.
def is_right_triangle(a, b, c):
    # Sorting sides so that C is the largest
    sides = sorted([a, b, c])
    # Pythagorean Relationship
    return sides[0]**2 + sides[1]**2 == sides[2]**2, sides[2]

if __name__ == "__main__":
    # Get the sides of the triangle from the user
    while True:
        try:
            a = float(input("لطفاً اندازه ضلع اول مثلث را وارد کنید: "))
            b = float(input("لطفاً اندازه ضلع دوم مثلث را وارد کنید: "))
            c = float(input("لطفاً اندازه ضلع سوم مثلث را وارد کنید: "))
            break
        except ValueError:
            print("لطفاً یک عدد صحیح یا اعشاری وارد کنید.")

    # Check. If the triangle is the vertical
    is_right, hypotenuse = is_right_triangle(a, b, c)

    if is_right:
        print(f"مثلث قائم الزاویه است. ضلع وتر: {hypotenuse}")
    else:
        print("مثلث قائم الزاویه نیست.")
Mma123 Download Python
P = int(input("Enter P: "))
G = int(input("Enter G: "))
R = int(input('Enter R: '))

if P*P==G*G+R*R:
    print("true")
else:
    print("false")
Amirali Download Python
a=int(input("Enter the legth of the side of the triangle:"))
b=int(input("Enter the second length of the side of the triangle: "))
c=int(input("Enter the length of the VATAR:"))
d=("the triangle has a 90 degrees angle & c is vatar")
if c**2==(b**2)+(a**2):
    print(d)
else:
    print("the triangle does not have a 90 degrees angle")
x = float(input("enter x :"))
y = float(input("enter y :"))
z = float(input("enter z :"))
if z**2 == y**2 + x**2 or x**2 == y**2 + z**2 or y**2 == x**2 + z**2:
    print("It's a right-angled triangle")    # The triangle is an angle
    if z**2 == y**2 + x**2:
        print("z = hypotenuse")     # The chord is z
    elif x**2 == y**2 + z**2:
        print("x = hypotenuse")     # The chord is x
    elif y**2 == x**2 + z**2:
        print("y = hypotenuse")     # The chord is y
else :
    print("It's not a right-angled triangle")   # The triangle is not an angle
Ali.r.h.z Download Python

Can use int instead of Float Ali.r.h.z


def math():
	a=int(input("ضلع اول را وارد کن"))
	b=int(input("ضلع دوم را وارد کن"))
	c=int(input("وتر را وارد کن"))
	
	if a**2+b**2==c**2:
		print("بله")
	else:
		print("نه")
math()
Roghaye.m Download Python
a=int(input('please enter your number(vatare):'))
b=int(input('please enter your number:'))
c=int(input('please enter your number:'))
if a**2==b**2+c**2:
    print('this triangle is a right triangle')
else:
    print('this triangle is not a right triangle')
Hamedfari Download Python
a=float(input('input first side of triangle:'))
b=float(input('input second side of triangle:'))
c=float(input('input third side of triangle:'))
if a**2+b**2==c**2:
    print('right triangle')
else:
    print('its not right triangle')
Maryam.n Download Python
<< Previous page 1 2 Next page >>

Submit answer

Submitting answers is currently unavailable.

Related content

Detection using AI
×
×
Close