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
Lena [83]
3 years ago
14

Write a function is_rightangled which, given the length of three sides of a triangle, will determine whether the triangle is rig

ht-angled. Assume that the third argument to the function is always the longest side. It will return True if the triangle is right-angled, or False otherwise. Hint: floating point arithmetic is not always exactly accurate, so it is not safe to test floating point numbers for equality. If a good programmer wants to know whether x is equal or close enough to y, they would probably code it up as
Computers and Technology
1 answer:
Olenka [21]3 years ago
5 0

Answer:

Written in Python:

def is_rightangled(a,b,c):

     if abs(c**2 - (a**2 + b**2) < 0.001):

           return "True"

     else:

           return "False"

       

a = float(input("Side 1: "))

b = float(input("Side 2: "))

c = float(input("Side 3: "))

print(is_rightangled(a,b,c))

Explanation:

The function is defined here

def is_rightangled(a,b,c):

The following if statement implements Pythagoras theorem c^2 = a^2 + b^2 by checking if the left hand side is approximately equal to the right hand side

<em>      if abs(c**2 - (a**2 + b**2) < 0.001):</em>

<em>            return "True"</em>

<em>      else:</em>

<em>            return "False"</em>

If the specified condition is met, the if function returns true; Otherwise, it returns false.

The main function starts here

The next three line prompts user for the sides of the triangle

<em>a = float(input("Side 1: "))</em>

<em>b = float(input("Side 2: "))</em>

<em>c = float(input("Side 3: "))</em>

The next line calls the defined function

print(is_rightangled(a,b,c))

You might be interested in
the list of available fonts in the fonts gallery may differ, depending on what fonts you have installed and the type of printer
aalyn [17]
I believe the correct answer is true. The <span>list of available fonts in the fonts gallery may differ, depending on what fonts you have installed and the type of printer you are using. Not all fonts would be available in all computers and for all printers. It should be installed first before use.</span>
5 0
3 years ago
A _ is the acknowledgment of a potential noncomformity, or an opinion regarding an issue that is not covered by a standard
sleet_krkn [62]
Assumption - hope this helped took the test and got 100
5 0
3 years ago
How do open online courses help with independent learning
Dahasolnce [82]

Answer:

One of the most powerful benefits of online courses is that they enable students to learn at the time, place, and pace that best suits their individual learning style. ... If there is a class discussion, you can take time to gather your thoughts rather than be in a race to get the teacher's attention.

Explanation:

6 0
3 years ago
Read 2 more answers
Is ryan patrick cullen gay
pshichka [43]

who is that? ..........

6 0
3 years ago
Read 2 more answers
Ryan wants to ensure that all the words in this document are evenly spaced so that they look neat and readable . Which option in
natka813 [3]
To achieved a document that is evenly spaced so that they look neat and readable, the option in a word processing program will help to achieve this is the home setting. In the home of the word, you can see there various tabs, one of the tabs is the paragraph. You will click symbol of "justify". And there is simple code to do that, just press the "Ctrl" and "J" on your keyboard at the same time.
5 0
3 years ago
Other questions:
  • While traveling in India, Sabina notes all of her daily expenses in rupees in her spreadsheet. At the end of the day, she wants
    5·2 answers
  • Kwan is using JavaScript extensively to add interactivity to his Web site. Contained within his script is a counter object that
    8·1 answer
  • Where could an identity theft access your personal information
    9·2 answers
  • You have a workstation running windows vista business that you would like to upgrade to windows 7 ultimate. you want to perform
    11·1 answer
  • Knowledge management software helps companies preserve the knowledge gained through the use of information so that future users
    15·2 answers
  • I make a budget of my 1st Gamer PC its good?
    9·1 answer
  • Write a program to print the area of a rectangle by creating a class named 'Area' having two methods. First method named as 'set
    6·1 answer
  • You construct a simple electrical current to boil water for tea. A battery generates positive and negative charges. A wire conne
    13·1 answer
  • Edhesive 6.2
    6·2 answers
  • How does one of the algorithms in your program function?
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!