# Suppose you are flying a drone that can fly exactly 100 km before needing a battery recharge. Recharging is only possible at towns for which you are…

Please help solve this in Python!

Suppose you are flying a drone that can fly exactly 100 km before needing a battery recharge. Recharging is only possible at towns for which you are given locations. Your aim is to find the length of the shortest possible path to get the drone from an origin town to a destination town given the range restriction.

Assume that the landscape is a n × n two dimensional square (units are km) with coordinates for towns described by (x, y) where 0 <= x, y <= n. Use Euclidean distance to calculate the distance between towns.

__Input format:__

You are given multiple lines of input. Each line has 2k + 1 comma separated numbers where k ≥ 2. The first number in each line is the size of the landscape, n. The following 2k numbers locations of k towns so that that the ith town is located at (2i, 2i + 1). In each line the first town listed is the origin, the final town listed in the destination.

For example:

100,0,0,0,100,100,100

1000,20.892,986,602,138.97,206.2,10.44

200,25,25,10,1,50,25,140,30

__Output format: __

For each line of input, output a single number which is the length of the shortest path from the origin town to the destination town. Use str.format to give this value to 2 decimal places. Precisely, format x using ‘{:.2f}’.format(x). Do not use any other rounding throughout your algorithm. If the destination town is unreachable from the origin, output -1.

For the example input aboves, output would be:

200.00

-1

115.14

## How it Works

1

It only takes a couple of minutes to fill in your details, select the type of paper you need (essay, term paper, etc.), give us all necessary information regarding your assignment.

2

Once we receive your request, one of our customer support representatives will contact you within 24 hours with more specific information about how much it'll cost for this particular project.

3

After receiving payment confirmation via PayPal or credit card – we begin working on your detailed outline, which is based on the requirements given by yourself upon ordering.

4

Once approved, your order is complete and will be emailed directly to the email address provided before payment was made!