Computers and Technology

You will create a program that will take in the values of 3 sides of a triangle and determine if that triangle is a right triangle by using the Pythagorean Theorem. I have provided the pseudocode for you below. All you need to do is translate the pseudocode to a Python program that will run and output correctly if the user has entered a Pythagorean triple or not..

You can test your program by entering the following values:

Enter 12, 5, 13 and it should tell you β€œYes! You have a right triangle.”
Enter 5, 7, 10 and it should tell you β€œNo! You DO NOT have a right triangle.”

PROCEDURE getSides()

{

>

DISPLAY (What is the length of the first side?)

side1 ← INPUT()

DISPLAY (What is the length of the second side?)

side2 ← INPUT()

DISPLAY (What is the length of the third side?)

side3 ← INPUT()

}

PROCEDURE decideHypotenuse()

{

>

IF ((side1 > side3) AND (side1 > side2))

{

hypotenuse ← side1;

leg1 ← side2;

leg2 ← side3;

}

ELSE

{

leg1 ← side1;

IF (side2 > side3)

{

hypotenuse ← side2;

leg2 ← side3;

}

ELSE

{

hypotenuse ← side3;

leg2 ←side2;

}

}

}

PROCEDURE isItRight()

{

IF ((leg1 * leg1 ) + (leg2 * leg2 ) == (hypotenuse * hypotenuse ))

{

DISPLAY (Yes! You have a right triangle.)

}

ELSE

{
DISPLAY (No! You DO NOT have a right triangle.)

}

}

getSides()
decideHypotenuse()
isItRight()

answer
Answers: 1

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 13:30, 21megoplin
In which phase does software coding and testing happen in the spiral model? the spiral model does not have a separate testing phase. both, software coding and testing occurs during the phase.
Answers: 3
image
Computers and Technology, 22.06.2019 18:00, jabezslade22
What is the first view you place in your drawing?
Answers: 1
image
Computers and Technology, 22.06.2019 18:30, smariedegray
All of the following are characteristics that must be contained in any knowledge representation scheme except
Answers: 3
image
Computers and Technology, 22.06.2019 18:30, leannhb3162
Which of these options are the correct sequence of actions for content to be copied and pasted? select content, click the copy button, click the paste button, and move the insertion point to where the content needs to be inserted. click the copy button, select the content, move the insertion point to where the content needs to be inserted, and click the paste button. select the content, click the copy button, move the insertion point to where the content needs to be inserted, and click the paste button. select the content, move the insertion point to where the content needs to be inserted, click the copy button, and click the paste button.
Answers: 3
Do you know the correct answer?
You will create a program that will take in the values of 3 sides of a triangle and determine if tha...

Questions in other subjects:

Konu
Biology, 08.04.2020 18:38
Konu
Mathematics, 08.04.2020 18:38