Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

CSE_120 Sir_it_is_urgent.do_fast._Please_solve_this_code_in_python3_paste_with_proper_intendent_blocks_bypressing(CTRL+SHIFT+V),Also_please_provide_code_screenshot,_Thank_you. Do_not_need_comments. SKIP_BUILT_IN_FUNCTIONS. Just_give_me_solution_as_fast_as_possible._I_am_running_out_of_time._Attach_a_screenshot_with_yoursolve. Question-2: The coordinates of different persons are given in the following dictionary. position = {'A': (2, 5), 'B': (1, 7),

CSE_120

Sir_it_is_urgent.do_fast._Please_solve_this_code_in_python3_paste_with_proper_intendent_blocks_bypressing(CTRL+SHIFT+V),Also_please_provide_code_screenshot,_Thank_you.

Do_not_need_comments. SKIP_BUILT_IN_FUNCTIONS. Just_give_me_solution_as_fast_as_possible._I_am_running_out_of_time._Attach_a_screenshot_with_yoursolve.

Question-2: The coordinates of different persons are given in the following dictionary.

position = {'A': (2, 5), 'B': (1, 7), 'C': (9, 5), 'D': (2, 6)}

You will take 2 inputs for person Xs location where the first input specifies person Xs current location in the x-axis and the second input specifies person Xs current location in the y-axis.

Your work is to find the person closest to person X by calculating the distance between person X and every other person in the dictionary.

Hint: The distance between two coordinates is given by the formula (You need to import math):

math.sqrt((x2 - x1)2 + (y2 - y1)2) ================================================ Sample Input 1: Enter person Xs x coordinate: 3 Enter person Xs y coordinate: 6

Sample Output 1: D

Explanation 1: X is at (3,6). The distance between person X and person A: 2 The distance between person X and person B: 5 The distance between person X and person C: 37 The distance between person X and person D: 1

The least distance is between person X and D. So, D is selected ================================================

Sample Input 2: Enter person Xs x coordinate: 3 Enter person Xs y coordinate: 5

Sample Output 2: A

Explanation 1: X is at (3,5). The distance between person X and person A: 1 The distance between person X and person B: 22 The distance between person X and person C: 6 The distance between person X and person D: 2 The least distance is between person X and A. So, A is selected

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_step_2

Step: 3

blur-text-image_step3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Concepts

Authors: David M Kroenke, David J Auer

6th Edition

ISBN: 0132742926, 978-0132742924

More Books

Students also viewed these Databases questions

Question

With your help we will soon begin.

Answered: 1 week ago

Question

Explain Promotion Mix.

Answered: 1 week ago

Question

Explain the promotional mix elements.

Answered: 1 week ago

Question

1. There are many social organisations around us?

Answered: 1 week ago

Question

Why advertising is important in promotion of a product ?

Answered: 1 week ago

Question

We got our small business loan an enormous advantage.

Answered: 1 week ago

Question

Ron Franklin do you remember him? will be in town Monday.

Answered: 1 week ago