Skip to content

Commit 8a46b69

Browse files
authored
Create README.md
1 parent 1927352 commit 8a46b69

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
![](http://ForTheBadge.com/images/badges/made-with-python.svg)
2+
![](https://forthebadge.com/images/badges/built-by-developers.svg)</br>
3+
[![Prettier](https://img.shields.io/badge/Code%20Style-Prettier-red.svg)](https://github.com/prettier/prettier)
4+
![License](https://img.shields.io/badge/License-MIT-red.svg)</br>
5+
6+
## Description:
7+
- Let's [**look**](https://github.com/Iamtripathisatyam/Awesome_Python_Scripts/blob/main/BasicPythonScripts/Distance%20Finder/distance.py) at a Python script that calculates the distance between two locations.
8+
- It accepts two cities as input and calculates longitude and latitude for them.
9+
- Finally, the result will be displayed in kilometres.
10+
11+
## Procedure to follow:
12+
```python
13+
from geopy.geocoders import Nominatim
14+
from geopy.distance import geodesic
15+
```
16+
- Set the user agent where all the data will be fetched using the **Nominatim** function; in our example, it'll be **Google Map**.
17+
- Take the user's input for two cities.
18+
- Now, using **geocode**, retrieve all of the data, including all of the city's details, such as **latitude**, **longitude**, and so on.
19+
- Both cities longitude and latitude should be saved in separate variables.
20+
- Use **geodesic** to determine the city's name based on its longi and lati.
21+
- Finally, in kilometers, display the result.
22+
23+
24+
## Sample Output:
25+
26+
![hey](https://github.com/Iamtripathisatyam/Awesome_Python_Scripts/blob/main/BasicPythonScripts/Distance%20Finder/output.jpg)

0 commit comments

Comments
 (0)