1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
lyudmila [28]
2 years ago
8

The set of three integer values for the lengths of the sides of a right triangle is called a Pythagorean triple. These three sid

es must satisfy the relationship that the sum of the two sides is equal to the square of the hypotenuse. Find all integer Pythagorean triples for side1, side2, and the hypotenuse, all no larger than 500. Use a triple-nested for loop that tries all possibilities. This program is an example of brute force computing. You will learn in more advanced computer science courses that there are many interesting problems for which there is no algorithmic approach other than using sheer brute force. This program does not need any input from the user. Write at least one bool function that takes the 3 sides of the triangle and returns true or false based on if it is a right triangle or not.
Computers and Technology
1 answer:
Sloan [31]2 years ago
8 0

Answer:

In Python:

def  Pythagorean_triple(hyp,side1,side2):

   if hyp**2 == side1**2 + side2*2:

       return True

   else:

       return False

               

print("Hypotenuse\tSide 1\t Side 2\t Return Value")

for i in range(1,501):

   for j in range(1,501):

       for k in range(1,501):

           print(str(i)+"\t"+str(j)+"\t"+str(k)+"\t"+str(Pythagorean_triple(i,j,k)))

Explanation:

This defines the function

def  Pythagorean_triple(hyp,side1,side2):

This checks for pythagorean triple

   if hyp**2 == side1**2 + side2*2:

Returns True, if true

       return True

   else:

Returns False, if otherwise

       return False

               

The main method begins

This prints the header

print("Hypotenuse\tSide 1\t Side 2\t Return Value")

The following is a triple-nested loop [Each of the loop is from 1 to 500]

for i in range(1,501): -->The hypotenuse

   for j in range(1,501): -->Side 1

       for k in range(1,501):-->Side 2

This calls the function and prints the required output i.e. the sides of the triangle and True or False

           print(str(i)+"\t"+str(j)+"\t"+str(k)+"\t"+str(Pythagorean_triple(i,j,k)))

You might be interested in
In what document does the program manager (pm) address the demilitarization and disposal requirements?
Nana76 [90]

Life Cycle Sustainment Plan (LCSP) is the document that the program manager (pm) addresses the demilitarization and disposal requirements.

<h3>What is Life Cycle Sustainment Plan?</h3>

Life Cycle Sustainment Plan is a plan or service that works during the trade of weapons or system work regarding militarization. This system works on the development and handling of the weapon system.

So, Life Cycle Sustainment Plan will be used in the demilitarization and management requirements.

Thus, the name of the document program is Life Cycle Sustainment Plan.

To learn more about Life Cycle Sustainment Plan, refer to the below link:

brainly.com/question/1272845?referrer=searchResults

#SPJ1

3 0
1 year ago
What is TCP/IP's Transport layer's primary duty?
lorasvet [3.4K]

Answer:

 The TCP/IP is the transmission control protocol and internet protocol and in the TCP/IP model the transport layer is the second layer.

The primary responsibility of this layer is that it is basically used to deliver messages to the host and that is why it is known as end to end layer.

It basically provide the point to point connection between the destination to server host for delivering the various types of the services efficiently and reliably.

In the TCP/IP model the transport layer are basically responsible for transferring the data or service error free between the server to destination host.

3 0
3 years ago
The act of using computer equipment to “break into” the computer systems of others?
zlopas [31]

Answer:

Hacking.

Explanation:

Breaking into other systems sounds like hacking.

3 0
2 years ago
What are the real-life applications of coding?
oksian1 [2.3K]

Some example's of coding affecting real life:

  • Traffic Lights
  • Biometric Security
  • Robots used in factories. can work in extreme conditions.
  • Automatic Heater or Air Conditioner.
  • Expert Systems used in for Medical Use.
  • Smart Self Driving Cars
8 0
2 years ago
Special keys that allow you to use the computer to perform specific functions
Pavel [41]

Answer:

Examples are Ctrl, Alt, Fn, Alt Gr, Shift, Caps Lock, Tab, Scroll Lock, Num lock, Esc, Windows Key, Backspace, Enter...

8 0
3 years ago
Other questions:
  • Jared does not update his computer’s system software. What threat does his computer face?
    9·1 answer
  • Consists of a drive letter (preceded by a drive name when necessary) and colon, to identify the storage device, and one or more
    5·1 answer
  • Java provides a(n) ____ class, which contains many useful methods for manipulating arrays.
    5·1 answer
  • In the structure of a conventional processor, what is the purpose of the data path?
    15·1 answer
  • Which of the following are examples of how a company might use consumer data it had collected? a To decide what types of product
    10·1 answer
  • Design a function that checks if a keyword exists in a given keyword tree and returns true if so and returns false otherwise. Af
    13·2 answers
  • ____________________ is the primary code humans use to communicate. (Points : 1
    9·1 answer
  • Im getting hit offline can someone help or give me some advice
    6·1 answer
  • Please tell me the answer
    5·1 answer
  • Colours can be contrasting if<br>​
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!