Question: Can someone please help with problem 5? I have to write a code that follows the step-by-step instructions seen in red in the Linux Mint

Can someone please help with problem 5? I have to write aCan someone please help with problem 5? I have to write a code that follows the step-by-step instructions seen in red in the Linux Mint software.

Problem 5. (Closest Point) Write a program that takes three floats x, y, and z from the command line, reads from standard input a sequence of coordinates (i, yi, 2i), and writes the coordinates of the point closest to (r,y, z). Recall that the square of the distance between (z, y, z) and (zi yi, 2i) is (z-ri)2 + (y Vi)2 + (z &J2 For efficiency, do not use either math sqrt() or theoperator S python3 closest py 1.0 5.0 1.0 3.0 9.0 5.0 3.0 2.5 9.0 6.0 2.0 2.O 6.0 3.0 5.0 6.0 5.0 closest point (2.000000, 6.000000, 3.000000) Linux Mint [Running] closest.py (/coursework/homework5) File Edit View Search Tools Documents Help closest.py: takes three floats x, y, and z from the command line, reads from # standard input a sequence of coordinates (xi, yi, z-1), and writes the # coordinates of the point closest to (x, y, z). import stdio import sys # Read x, y, and z from command line, as floats. # closest squared-distance so far, initialized to infinity bestDist2 = float(' inf . ) # Read coordinates (xi, yi, zi) from standard input and calculate its # squared-distance to the point (x, y, z). Check if that value is smaller # than bestDist2, and if so, update bestDist2 to the new value, and # let (bestx, besty, bestz) be (xi, yi, zi). while .. . : # Write the closest point (bestx, besty, bestz). stdio.writef ( "closest point (%f, %f , %f ) ., ) , , Problem 5. (Closest Point) Write a program that takes three floats x, y, and z from the command line, reads from standard input a sequence of coordinates (i, yi, 2i), and writes the coordinates of the point closest to (r,y, z). Recall that the square of the distance between (z, y, z) and (zi yi, 2i) is (z-ri)2 + (y Vi)2 + (z &J2 For efficiency, do not use either math sqrt() or theoperator S python3 closest py 1.0 5.0 1.0 3.0 9.0 5.0 3.0 2.5 9.0 6.0 2.0 2.O 6.0 3.0 5.0 6.0 5.0 closest point (2.000000, 6.000000, 3.000000) Linux Mint [Running] closest.py (/coursework/homework5) File Edit View Search Tools Documents Help closest.py: takes three floats x, y, and z from the command line, reads from # standard input a sequence of coordinates (xi, yi, z-1), and writes the # coordinates of the point closest to (x, y, z). import stdio import sys # Read x, y, and z from command line, as floats. # closest squared-distance so far, initialized to infinity bestDist2 = float(' inf . ) # Read coordinates (xi, yi, zi) from standard input and calculate its # squared-distance to the point (x, y, z). Check if that value is smaller # than bestDist2, and if so, update bestDist2 to the new value, and # let (bestx, besty, bestz) be (xi, yi, zi). while .. . : # Write the closest point (bestx, besty, bestz). stdio.writef ( "closest point (%f, %f , %f ) ., )

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!