Map Cordinates Python
A road map defines locations as map references like B3, where B is the x-coordinate value and 3 is the y-coordinate.
The grid lines are 0.5 km apart.
I'm writing a program that allows the user to enter a trip as a sequence of any number of map references on one line, and reports the total length of the trip, assuming they can travel in straight lines.
Like in the below picture:
Can please somebody instruct me how to do this?
This sounds like a job for the distance formula!
To calculate the distance between two points in 2D space, use this formula:
where the X's and Y's are the coordinates of the two points.
All you'd need to do then is to convert those letters into points, prefferably by keeping an array of letters and finding the index of each.