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
Assoli18 [71]
3 years ago
13

Write a program that reads from the user any three points in two dimensional space: x1, y1, x2, y2, x3, y3. Assume these points

form a line segment, (x1, y1) to (x2, y2) to (x3, y3). Calculate the sum of these line segments and print value to two decimal places.For example with points (0.0, 0.0), (3.0, 4.0), (6.0, 8.0), the distance for the first segment is 5.0, the second segment is 5.0, so the output for this case would be 10.00. The input and output for this case would be:INPUT:0.0 0.03.0 4.06.0 8.0OUTPUT: 10.00
Computers and Technology
1 answer:
netineya [11]3 years ago
6 0

Answer:

The solution code is written in Python:

  1. import math  
  2. coord= input("Enter coordinates for three points: ")
  3. coordList = coord.split(" ")
  4. for i in range(0, len(coordList)):
  5.    coordList[i] = float(coordList[i])
  6. seg_1 = math.sqrt((coordList[0] - coordList[2])**2 + (coordList[1]- coordList[3])**2)
  7. seg_2 = math.sqrt((coordList[2] - coordList[4])**2 + (coordList[3]- coordList[5])**2)
  8. print(seg_1 + seg_2)

Explanation:

Firstly, we can use Python built-in method <em>input()</em> to get coordinates for three points from user (Line 3). To simplify the entry process, the input of the three coordinates is expected in a single string 0.0 0.0 3.0 4.0 6.0 8.0O. Please note each of the coordinates is separated by a single space.

Next, we can proceed to use Python string split() method and single space character " " as separator to break the input string of coordinates into a list of individual numbers ["0.0", "0.0", "3.0", "4.0", "6.0", "8.0"].

Prior to calculating the line segment, it is important to ensure the coordinates in the list,<em> coordList</em>, have been converted from string to float type (Line 6 - 7).

Next, we are ready to apply the Distance formula to calculate the length of the two line segments that join the three coordinates (Line 9 and Line 11).  The distance formula is \sqrt{ (x1 - x2){^2}  +  (y1 - y2){^2}   }

At last, sum up the two line segments, <em>seg_1 </em>& <em>seg_2 </em>and print it in the terminal (Line 13).

You might be interested in
What is a bin range?
S_A_V [24]
The answer will be A! hope i helped!
4 0
3 years ago
Help pleaseee got 15 points on this
miskamm [114]
I belive it is vtr deck
4 0
3 years ago
Can anyone give me Nitro type gold please? My NT account is trapkaybee061307
Rasek [7]

Answer:

no

Explanation:

3 0
3 years ago
Read 2 more answers
​ Search engines can perform date-filtered searches because, when web servers send a webpage to a ____, they include a header th
konstantin123 [22]

Answer: B) Search engine's web robot

Explanation:

 Search engine is basically use the data or information in the webpage and it is also a web base tool which enabled the users for locating the information and data in the world wide web.

It is basically perform various date filtered searches as the web server send the webpage to the search engine web robot. It also include a header which basically contain data in the web page, when it is last modified.

Therefore, Option (C) is correct.

5 0
3 years ago
Which command is used to encrypt all passwords in a router configuration file?
Veseljchak [2.6K]

Answer:

Service Password encryption

Explanation:

It is noted that the command used on routers, to get the data of all the passwords in a router configuration file encrypted is the service password encryption.

Service password encryption solely affects plain text passwords types that includes that of the line passwords or that of the enable password. The feature uses a simple substitution method to create a "secure" non-text password displayed in the configuration.

8 0
3 years ago
Other questions:
  • Who wants to join my zoom after school 23456+4567
    15·1 answer
  • Gregor installed a third stick of known-good RAM into his Core i7 system, bringing the total amount of RAM up to 3 GB. Within a
    12·1 answer
  • Ten examples of an interpreter
    8·1 answer
  • MATH PLZ HELP ITS DUE IN 4 MINUTES​
    6·2 answers
  • What power points feature will you use to apply motion effects to different objects of a slide
    5·1 answer
  • Brenda has created a Microsoft Excel spreadsheet which has 1000's of cells of data. She is looking for specific information in t
    11·1 answer
  • write an expression taht evaluated to true if and only if the variable s does not contain the string 'end'
    12·1 answer
  • Which type of relationship is responsible for teaching you values and how to communicate?
    9·1 answer
  • Which block cipher mode of operating requires that both the message sender and receiver access a counter that computes a new val
    9·1 answer
  • Connect research concepts to their definitions
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!